Save issue IRIs when creating them from AS objects
This commit is contained in:
parent
1066cfe785
commit
77896f1a50
|
@ -2474,7 +2474,10 @@ func DeleteOrphanedIssues() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (issue *Issue) GetIRI() string {
|
func (issue *Issue) GetIRI() string {
|
||||||
_ = issue.LoadRepo(db.DefaultContext)
|
err := issue.LoadRepo(db.DefaultContext)
|
||||||
|
if err != nil {
|
||||||
|
log.Error(fmt.Sprintf("loadRepo: %v", err))
|
||||||
|
}
|
||||||
if strings.Contains(issue.Repo.OwnerName, "@") {
|
if strings.Contains(issue.Repo.OwnerName, "@") {
|
||||||
return issue.OriginalAuthor
|
return issue.OriginalAuthor
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,14 +213,15 @@ func createIssue(ctx context.Context, ticket *forgefed.Ticket) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
issue := &issues_model.Issue{
|
issue := &issues_model.Issue{
|
||||||
Index: idx, // This doesn't seem to work?
|
Index: idx, // This doesn't seem to work?
|
||||||
RepoID: repo.ID,
|
RepoID: repo.ID,
|
||||||
Repo: repo,
|
Repo: repo,
|
||||||
Title: ticket.Summary.String(),
|
Title: ticket.Summary.String(),
|
||||||
PosterID: user.ID,
|
PosterID: user.ID,
|
||||||
Poster: user,
|
Poster: user,
|
||||||
Content: ticket.Content.String(),
|
Content: ticket.Content.String(),
|
||||||
IsClosed: ticket.IsResolved,
|
OriginalAuthor: ticket.GetLink().String(), // Create new database field to store IRI?
|
||||||
|
IsClosed: ticket.IsResolved,
|
||||||
}
|
}
|
||||||
return issue_service.NewIssue(repo, issue, nil, nil, nil)
|
return issue_service.NewIssue(repo, issue, nil, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ func CreateIssueComment(doer *user_model.User, repo *repo_model.Repository, issu
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(repo.Owner.Name, "@") {
|
if strings.Contains(repo.OwnerName, "@") {
|
||||||
// Federated comment
|
// Federated comment
|
||||||
// Refactor this to its own function in services/activitypub
|
// Refactor this to its own function in services/activitypub
|
||||||
create := ap.Create{
|
create := ap.Create{
|
||||||
|
|
Reference in New Issue