aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/notification/action/action.go18
-rw-r--r--modules/templates/helper.go4
2 files changed, 18 insertions, 4 deletions
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index 36035b864f..d4be1e4304 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -148,18 +148,28 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
}
}
- if strings.TrimSpace(comment.Content) != "" {
- actions = append(actions, &models.Action{
+ if review.Type != models.ReviewTypeComment || strings.TrimSpace(comment.Content) != "" {
+ action := &models.Action{
ActUserID: review.Reviewer.ID,
ActUser: review.Reviewer,
Content: fmt.Sprintf("%d|%s", review.Issue.Index, strings.Split(comment.Content, "\n")[0]),
- OpType: models.ActionCommentIssue,
RepoID: review.Issue.RepoID,
Repo: review.Issue.Repo,
IsPrivate: review.Issue.Repo.IsPrivate,
Comment: comment,
CommentID: comment.ID,
- })
+ }
+
+ switch review.Type {
+ case models.ReviewTypeApprove:
+ action.OpType = models.ActionApprovePullRequest
+ case models.ReviewTypeReject:
+ action.OpType = models.ActionRejectPullRequest
+ default:
+ action.OpType = models.ActionCommentIssue
+ }
+
+ actions = append(actions, action)
}
if err := models.NotifyWatchersActions(actions); err != nil {
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 1347835b80..6aa429ee14 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -555,6 +555,10 @@ func ActionIcon(opType models.ActionType) string {
return "issue-reopened"
case models.ActionMirrorSyncPush, models.ActionMirrorSyncCreate, models.ActionMirrorSyncDelete:
return "repo-clone"
+ case models.ActionApprovePullRequest:
+ return "eye"
+ case models.ActionRejectPullRequest:
+ return "x"
default:
return "invalid type"
}