@@ -46,15 +46,22 @@ func DeleteWikiPage(ctx context.Context, doer *user_model.User, repo *repo_model
4646 }
4747}
4848
49- // CreateIssueComment notifies issue comment related message to notifiers
50- func CreateIssueComment (ctx context.Context , doer * user_model.User , repo * repo_model.Repository ,
51- issue * issues_model.Issue , comment * issues_model.Comment , mentions []* user_model.User ,
52- ) {
49+ func shouldSendCommentChangeNotification (ctx context.Context , comment * issues_model.Comment ) bool {
5350 if err := comment .LoadReview (ctx ); err != nil {
5451 log .Error ("LoadReview: %v" , err )
55- return
52+ return false
5653 } else if comment .Review != nil && comment .Review .Type == issues_model .ReviewTypePending {
5754 // Pending review comments updating should not triggered
55+ return false
56+ }
57+ return true
58+ }
59+
60+ // CreateIssueComment notifies issue comment related message to notifiers
61+ func CreateIssueComment (ctx context.Context , doer * user_model.User , repo * repo_model.Repository ,
62+ issue * issues_model.Issue , comment * issues_model.Comment , mentions []* user_model.User ,
63+ ) {
64+ if ! shouldSendCommentChangeNotification (ctx , comment ) {
5865 return
5966 }
6067
@@ -164,11 +171,7 @@ func PullReviewDismiss(ctx context.Context, doer *user_model.User, review *issue
164171
165172// UpdateComment notifies update comment to notifiers
166173func UpdateComment (ctx context.Context , doer * user_model.User , c * issues_model.Comment , oldContent string ) {
167- if err := c .LoadReview (ctx ); err != nil {
168- log .Error ("LoadReview: %v" , err )
169- return
170- } else if c .Review != nil && c .Review .Type == issues_model .ReviewTypePending {
171- // Pending review comments updating should not triggered
174+ if ! shouldSendCommentChangeNotification (ctx , c ) {
172175 return
173176 }
174177
@@ -179,11 +182,7 @@ func UpdateComment(ctx context.Context, doer *user_model.User, c *issues_model.C
179182
180183// DeleteComment notifies delete comment to notifiers
181184func DeleteComment (ctx context.Context , doer * user_model.User , c * issues_model.Comment ) {
182- if err := c .LoadReview (ctx ); err != nil {
183- log .Error ("LoadReview: %v" , err )
184- return
185- } else if c .Review != nil && c .Review .Type == issues_model .ReviewTypePending {
186- // Pending review comments updating should not triggered
185+ if ! shouldSendCommentChangeNotification (ctx , c ) {
187186 return
188187 }
189188
0 commit comments