Skip to content

Commit 2762921

Browse files
authored
Fix missed edit issues event for actions (#29237) (#29251)
Fix #29213 Backport #29237
1 parent 78f41e4 commit 2762921

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

services/actions/notifier.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,47 @@ func (n *actionsNotifier) NewIssue(ctx context.Context, issue *issues_model.Issu
5656
}).Notify(withMethod(ctx, "NewIssue"))
5757
}
5858

59+
// IssueChangeContent notifies change content of issue
60+
func (n *actionsNotifier) IssueChangeContent(ctx context.Context, doer *user_model.User, issue *issues_model.Issue, oldContent string) {
61+
ctx = withMethod(ctx, "IssueChangeContent")
62+
63+
var err error
64+
if err = issue.LoadRepo(ctx); err != nil {
65+
log.Error("LoadRepo: %v", err)
66+
return
67+
}
68+
69+
permission, _ := access_model.GetUserRepoPermission(ctx, issue.Repo, issue.Poster)
70+
if issue.IsPull {
71+
if err = issue.LoadPullRequest(ctx); err != nil {
72+
log.Error("loadPullRequest: %v", err)
73+
return
74+
}
75+
newNotifyInputFromIssue(issue, webhook_module.HookEventPullRequest).
76+
WithDoer(doer).
77+
WithPayload(&api.PullRequestPayload{
78+
Action: api.HookIssueEdited,
79+
Index: issue.Index,
80+
PullRequest: convert.ToAPIPullRequest(ctx, issue.PullRequest, nil),
81+
Repository: convert.ToRepo(ctx, issue.Repo, access_model.Permission{AccessMode: perm_model.AccessModeNone}),
82+
Sender: convert.ToUser(ctx, doer, nil),
83+
}).
84+
WithPullRequest(issue.PullRequest).
85+
Notify(ctx)
86+
return
87+
}
88+
newNotifyInputFromIssue(issue, webhook_module.HookEventIssues).
89+
WithDoer(doer).
90+
WithPayload(&api.IssuePayload{
91+
Action: api.HookIssueEdited,
92+
Index: issue.Index,
93+
Issue: convert.ToAPIIssue(ctx, issue),
94+
Repository: convert.ToRepo(ctx, issue.Repo, permission),
95+
Sender: convert.ToUser(ctx, doer, nil),
96+
}).
97+
Notify(ctx)
98+
}
99+
59100
// IssueChangeStatus notifies close or reopen issue to notifiers
60101
func (n *actionsNotifier) IssueChangeStatus(ctx context.Context, doer *user_model.User, commitID string, issue *issues_model.Issue, _ *issues_model.Comment, isClosed bool) {
61102
ctx = withMethod(ctx, "IssueChangeStatus")

0 commit comments

Comments
 (0)