@@ -46,10 +46,25 @@ func DeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
46
46
}
47
47
}
48
48
49
+ func shouldSendCommentChangeNotification (ctx context.Context , comment * issues_model.Comment ) bool {
50
+ if err := comment .LoadReview (ctx ); err != nil {
51
+ log .Error ("LoadReview: %v" , err )
52
+ return false
53
+ } else if comment .Review != nil && comment .Review .Type == issues_model .ReviewTypePending {
54
+ // Pending review comments updating should not triggered
55
+ return false
56
+ }
57
+ return true
58
+ }
59
+
49
60
// CreateIssueComment notifies issue comment related message to notifiers
50
61
func CreateIssueComment (ctx context.Context , doer * user_model.User , repo * repo_model.Repository ,
51
62
issue * issues_model.Issue , comment * issues_model.Comment , mentions []* user_model.User ,
52
63
) {
64
+ if ! shouldSendCommentChangeNotification (ctx , comment ) {
65
+ return
66
+ }
67
+
53
68
for _ , notifier := range notifiers {
54
69
notifier .CreateIssueComment (ctx , doer , repo , issue , comment , mentions )
55
70
}
@@ -156,13 +171,21 @@ func PullReviewDismiss(ctx context.Context, doer *user_model.User, review *issue
156
171
157
172
// UpdateComment notifies update comment to notifiers
158
173
func UpdateComment (ctx context.Context , doer * user_model.User , c * issues_model.Comment , oldContent string ) {
174
+ if ! shouldSendCommentChangeNotification (ctx , c ) {
175
+ return
176
+ }
177
+
159
178
for _ , notifier := range notifiers {
160
179
notifier .UpdateComment (ctx , doer , c , oldContent )
161
180
}
162
181
}
163
182
164
183
// DeleteComment notifies delete comment to notifiers
165
184
func DeleteComment (ctx context.Context , doer * user_model.User , c * issues_model.Comment ) {
185
+ if ! shouldSendCommentChangeNotification (ctx , c ) {
186
+ return
187
+ }
188
+
166
189
for _ , notifier := range notifiers {
167
190
notifier .DeleteComment (ctx , doer , c )
168
191
}
0 commit comments