diff --git a/models/action.go b/models/action.go
index bd7ceb4b3..dd642c6c1 100644
--- a/models/action.go
+++ b/models/action.go
@@ -50,6 +50,7 @@ const (
ActionMirrorSyncDelete // 20
ActionApprovePullRequest // 21
ActionRejectPullRequest // 22
+ ActionCommentPull // 23
)
// Action represents user operation type and other information to
diff --git a/models/repo_watch.go b/models/repo_watch.go
index 2279dcb11..7d421081a 100644
--- a/models/repo_watch.go
+++ b/models/repo_watch.go
@@ -210,7 +210,7 @@ func notifyWatchers(e Engine, act *Action) error {
if !act.Repo.checkUnitUser(e, act.UserID, false, UnitTypeIssues) {
continue
}
- case ActionCreatePullRequest, ActionMergePullRequest, ActionClosePullRequest, ActionReopenPullRequest:
+ case ActionCreatePullRequest, ActionCommentPull, ActionMergePullRequest, ActionClosePullRequest, ActionReopenPullRequest:
if !act.Repo.checkUnitUser(e, act.UserID, false, UnitTypePullRequests) {
continue
}
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go
index 7441de638..00f049d43 100644
--- a/modules/notification/action/action.go
+++ b/modules/notification/action/action.go
@@ -90,7 +90,6 @@ func (a *actionNotifier) NotifyIssueChangeStatus(doer *models.User, issue *model
func (a *actionNotifier) NotifyCreateIssueComment(doer *models.User, repo *models.Repository,
issue *models.Issue, comment *models.Comment) {
act := &models.Action{
- OpType: models.ActionCommentIssue,
ActUserID: doer.ID,
ActUser: doer,
Content: fmt.Sprintf("%d|%s", issue.Index, comment.Content),
@@ -100,6 +99,11 @@ func (a *actionNotifier) NotifyCreateIssueComment(doer *models.User, repo *model
CommentID: comment.ID,
IsPrivate: issue.Repo.IsPrivate,
}
+ if issue.IsPull {
+ act.OpType = models.ActionCommentPull
+ } else {
+ act.OpType = models.ActionCommentIssue
+ }
// Notify watchers for whatever action comes in, ignore if no action type.
if err := models.NotifyWatchers(act); err != nil {
@@ -208,7 +212,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
ActUserID: review.Reviewer.ID,
ActUser: review.Reviewer,
Content: fmt.Sprintf("%d|%s", review.Issue.Index, strings.Split(comm.Content, "\n")[0]),
- OpType: models.ActionCommentIssue,
+ OpType: models.ActionCommentPull,
RepoID: review.Issue.RepoID,
Repo: review.Issue.Repo,
IsPrivate: review.Issue.Repo.IsPrivate,
@@ -237,7 +241,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
case models.ReviewTypeReject:
action.OpType = models.ActionRejectPullRequest
default:
- action.OpType = models.ActionCommentIssue
+ action.OpType = models.ActionCommentPull
}
actions = append(actions, action)
diff --git a/modules/notification/mail/mail.go b/modules/notification/mail/mail.go
index e9a6ad7af..5148434dc 100644
--- a/modules/notification/mail/mail.go
+++ b/modules/notification/mail/mail.go
@@ -85,7 +85,7 @@ func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models
} else if comment.Type == models.CommentTypeReopen {
act = models.ActionReopenIssue
} else if comment.Type == models.CommentTypeComment {
- act = models.ActionCommentIssue
+ act = models.ActionCommentPull
}
if err := mailer.MailParticipantsComment(comment, act, pr.Issue); err != nil {
log.Error("MailParticipantsComment: %v", err)
diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 8b5497a1c..e0cdcbf60 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -548,7 +548,7 @@ func ActionIcon(opType models.ActionType) string {
return "issue-opened"
case models.ActionCreatePullRequest:
return "git-pull-request"
- case models.ActionCommentIssue:
+ case models.ActionCommentIssue, models.ActionCommentPull:
return "comment-discussion"
case models.ActionMergePullRequest:
return "git-merge"
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 97596451b..c9416e727 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -2047,6 +2047,7 @@ create_pull_request = `created pull request %s#%[2]s`
close_pull_request = `closed pull request %s#%[2]s`
reopen_pull_request = `reopened pull request %s#%[2]s`
comment_issue = `commented on issue %s#%[2]s`
+comment_pull = `commented on pull request %s#%[2]s`
merge_pull_request = `merged pull request %s#%[2]s`
transfer_repo = transferred repository %s
to %s
push_tag = pushed tag %[2]s to %[3]s
diff --git a/services/mailer/mail.go b/services/mailer/mail.go
index 7d26487a0..a8768de6c 100644
--- a/services/mailer/mail.go
+++ b/services/mailer/mail.go
@@ -291,7 +291,7 @@ func actionToTemplate(issue *models.Issue, actionType models.ActionType,
switch actionType {
case models.ActionCreateIssue, models.ActionCreatePullRequest:
name = "new"
- case models.ActionCommentIssue:
+ case models.ActionCommentIssue, models.ActionCommentPull:
name = "comment"
case models.ActionCloseIssue, models.ActionClosePullRequest:
name = "close"
diff --git a/services/mailer/mail_test.go b/services/mailer/mail_test.go
index fd87a157b..43e99c635 100644
--- a/services/mailer/mail_test.go
+++ b/services/mailer/mail_test.go
@@ -153,7 +153,7 @@ func TestTemplateSelection(t *testing.T) {
pull := models.AssertExistsAndLoadBean(t, &models.Issue{ID: 2, Repo: repo, Poster: doer}).(*models.Issue)
comment = models.AssertExistsAndLoadBean(t, &models.Comment{ID: 4, Issue: pull}).(*models.Comment)
- msg = testComposeIssueCommentMessage(t, &mailCommentContext{Issue: pull, Doer: doer, ActionType: models.ActionCommentIssue,
+ msg = testComposeIssueCommentMessage(t, &mailCommentContext{Issue: pull, Doer: doer, ActionType: models.ActionCommentPull,
Content: "test body", Comment: comment}, tos, false, "TestTemplateSelection")
expect(t, msg, "pull/comment/subject", "pull/comment/body")
diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl
index 48cdb49c1..7c4b1da0c 100644
--- a/templates/user/dashboard/feeds.tmpl
+++ b/templates/user/dashboard/feeds.tmpl
@@ -67,6 +67,9 @@
{{else if eq .GetOpType 22}}
{{ $index := index .GetIssueInfos 0}}
{{$.i18n.Tr "action.reject_pull_request" .GetRepoLink $index .ShortRepoPath | Str2html}}
+ {{else if eq .GetOpType 23}}
+ {{ $index := index .GetIssueInfos 0}}
+ {{$.i18n.Tr "action.comment_pull" .GetRepoLink $index .ShortRepoPath | Str2html}}
{{end}}
{{index .GetIssueInfos 1}}
{{else if eq .GetOpType 11}}