diff options
author | Earl Warren <earl-warren@noreply.codeberg.org> | 2024-12-24 07:28:36 +0100 |
---|---|---|
committer | Earl Warren <earl-warren@noreply.codeberg.org> | 2024-12-24 07:28:36 +0100 |
commit | 1fffd116e5d4326f4f7fd6b0d6ecb2b8447801b0 (patch) | |
tree | 7d6dd347f8e9718f0f7f3c77fa834a3b5cf9ed7d /services | |
parent | Merge pull request 'Update module google.golang.org/protobuf to v1.36.1 (forg... (diff) | |
parent | Add more load functions to make sure the reference object loaded (#32901) (diff) | |
download | forgejo-1fffd116e5d4326f4f7fd6b0d6ecb2b8447801b0.tar.xz forgejo-1fffd116e5d4326f4f7fd6b0d6ecb2b8447801b0.zip |
Merge pull request '[gitea] week 2024-52 cherry pick (gitea/main -> forgejo)' (#6342) from earl-warren/wcp/2024-52 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6342
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Diffstat (limited to 'services')
-rw-r--r-- | services/convert/pull.go | 5 | ||||
-rw-r--r-- | services/webhook/notifier.go | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/services/convert/pull.go b/services/convert/pull.go index 4ec24a8276..70dc22445a 100644 --- a/services/convert/pull.go +++ b/services/convert/pull.go @@ -29,6 +29,11 @@ func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *u err error ) + if err = pr.LoadIssue(ctx); err != nil { + log.Error("pr.LoadIssue[%d]: %v", pr.ID, err) + return nil + } + if err = pr.Issue.LoadRepo(ctx); err != nil { log.Error("pr.Issue.LoadRepo[%d]: %v", pr.ID, err) return nil diff --git a/services/webhook/notifier.go b/services/webhook/notifier.go index 8bfd03024f..fed33d8008 100644 --- a/services/webhook/notifier.go +++ b/services/webhook/notifier.go @@ -409,6 +409,10 @@ func (m *webhookNotifier) CreateIssueComment(ctx context.Context, doer *user_mod var pullRequest *api.PullRequest if issue.IsPull { eventType = webhook_module.HookEventPullRequestComment + if err := issue.LoadPullRequest(ctx); err != nil { + log.Error("LoadPullRequest: %v", err) + return + } pullRequest = convert.ToAPIPullRequest(ctx, issue.PullRequest, doer) } else { eventType = webhook_module.HookEventIssueComment |