diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-11-22 01:08:42 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-11-21 12:08:42 -0500 |
commit | d7ac9727bb5046118915cbb26b2dac1b7b27c9d4 (patch) | |
tree | c3a2209dcc3482506045706d426d95b3c83454fb /modules/notification/action | |
parent | d5261b9aab83138e31cbe02b1da9adc658ed400f (diff) | |
download | gitea-d7ac9727bb5046118915cbb26b2dac1b7b27c9d4.tar.gz gitea-d7ac9727bb5046118915cbb26b2dac1b7b27c9d4.zip |
Move merge actions to notification (#9024)
* Move merge actions to notification
* Add missing mail notification
Diffstat (limited to 'modules/notification/action')
-rw-r--r-- | modules/notification/action/action.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/notification/action/action.go b/modules/notification/action/action.go index dd4dc0ae32..70ab9975b2 100644 --- a/modules/notification/action/action.go +++ b/modules/notification/action/action.go @@ -10,6 +10,7 @@ import ( "strings" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/notification/base" ) @@ -191,3 +192,17 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review log.Error("notify watchers '%d/%d': %v", review.Reviewer.ID, review.Issue.RepoID, err) } } + +func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User, baseRepo *git.Repository) { + if err := models.NotifyWatchers(&models.Action{ + ActUserID: doer.ID, + ActUser: doer, + OpType: models.ActionMergePullRequest, + Content: fmt.Sprintf("%d|%s", pr.Issue.Index, pr.Issue.Title), + RepoID: pr.Issue.Repo.ID, + Repo: pr.Issue.Repo, + IsPrivate: pr.Issue.Repo.IsPrivate, + }); err != nil { + log.Error("NotifyWatchers [%d]: %v", pr.ID, err) + } +} |