1
0
Fork 0
forked from forgejo/forgejo

Move merge actions to notification (#9024)

* Move merge actions to notification

* Add missing mail notification
This commit is contained in:
Lunny Xiao 2019-11-22 01:08:42 +08:00 committed by techknowlogick
parent d5261b9aab
commit d7ac9727bb
6 changed files with 69 additions and 21 deletions

View file

@ -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)
}
}