remove duplicated actions
This commit is contained in:
parent
5067294f32
commit
0e063de211
|
@ -539,9 +539,11 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !opts.NoAction {
|
||||||
if err = sendCreateCommentAction(e, opts, comment); err != nil {
|
if err = sendCreateCommentAction(e, opts, comment); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err = comment.addCrossReferences(e, opts.Doer); err != nil {
|
if err = comment.addCrossReferences(e, opts.Doer); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -816,6 +818,7 @@ type CreateCommentOptions struct {
|
||||||
RefCommentID int64
|
RefCommentID int64
|
||||||
RefAction references.XRefAction
|
RefAction references.XRefAction
|
||||||
RefIsPull bool
|
RefIsPull bool
|
||||||
|
NoAction bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateComment creates comment of issue or commit.
|
// CreateComment creates comment of issue or commit.
|
||||||
|
|
|
@ -269,6 +269,13 @@ func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content strin
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if err := review.loadCodeComments(sess); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
if len(review.CodeComments) == 0 && len(strings.TrimSpace(content)) == 0 {
|
||||||
|
return nil, nil, ContentEmptyErr{}
|
||||||
|
}
|
||||||
|
|
||||||
review.Issue = issue
|
review.Issue = issue
|
||||||
review.Content = content
|
review.Content = content
|
||||||
review.Type = reviewType
|
review.Type = reviewType
|
||||||
|
@ -284,16 +291,13 @@ func SubmitReview(doer *User, issue *Issue, reviewType ReviewType, content strin
|
||||||
Issue: issue,
|
Issue: issue,
|
||||||
Repo: issue.Repo,
|
Repo: issue.Repo,
|
||||||
ReviewID: review.ID,
|
ReviewID: review.ID,
|
||||||
|
NoAction: true,
|
||||||
})
|
})
|
||||||
if err != nil || comm == nil {
|
if err != nil || comm == nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
comm.Review = review
|
comm.Review = review
|
||||||
|
|
||||||
if err := updateIssueCols(sess, review.Issue, "updated_unix"); err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
return review, comm, sess.Commit()
|
return review, comm, sess.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.TrimSpace(comment.Content) != "" {
|
||||||
actions = append(actions, &models.Action{
|
actions = append(actions, &models.Action{
|
||||||
ActUserID: review.Reviewer.ID,
|
ActUserID: review.Reviewer.ID,
|
||||||
ActUser: review.Reviewer,
|
ActUser: review.Reviewer,
|
||||||
|
@ -160,6 +161,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
|
||||||
Comment: comment,
|
Comment: comment,
|
||||||
CommentID: comment.ID,
|
CommentID: comment.ID,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if err := models.NotifyWatchersActions(actions); err != nil {
|
if err := models.NotifyWatchersActions(actions); err != nil {
|
||||||
log.Error("notify watchers '%d/%d': %v", review.Reviewer.ID, review.Issue.RepoID, err)
|
log.Error("notify watchers '%d/%d': %v", review.Reviewer.ID, review.Issue.RepoID, err)
|
||||||
|
|
Loading…
Reference in New Issue