Skip to content

Commit c2a8aac

Browse files
authored
Fix missed edit issues event for actions (#29237)
Fix #29213
1 parent 39f8ab5 commit c2a8aac

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
@@ -55,6 +55,47 @@ func (n *actionsNotifier) NewIssue(ctx context.Context, issue *issues_model.Issu
5555
}).Notify(withMethod(ctx, "NewIssue"))
5656
}
5757

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

0 commit comments

Comments
 (0)