diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-10-29 00:45:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-29 00:45:43 +0800 |
commit | af8957bc4ce78613fe03cb1abc6c961dd67ff344 (patch) | |
tree | b17b15eddca01c46d53d38abf184a2450e557de4 /services/pull | |
parent | e3875ace913ca428804acc9a9ee1cd0b06cd8026 (diff) | |
download | gitea-af8957bc4ce78613fe03cb1abc6c961dd67ff344.tar.gz gitea-af8957bc4ce78613fe03cb1abc6c961dd67ff344.zip |
Move issue notifications (#8713)
Diffstat (limited to 'services/pull')
-rw-r--r-- | services/pull/pull.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/pull/pull.go b/services/pull/pull.go index 959da67405..8e6110ac36 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -11,14 +11,21 @@ import ( "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" api "code.gitea.io/gitea/modules/structs" + issue_service "code.gitea.io/gitea/services/issue" ) // NewPullRequest creates new pull request with labels for repository. -func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, pr *models.PullRequest, patch []byte) error { +func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, pr *models.PullRequest, patch []byte, assigneeIDs []int64) error { if err := models.NewPullRequest(repo, pull, labelIDs, uuids, pr, patch); err != nil { return err } + for _, assigneeID := range assigneeIDs { + if err := issue_service.AddAssigneeIfNotAssigned(pull, pull.Poster, assigneeID); err != nil { + return err + } + } + if err := models.NotifyWatchers(&models.Action{ ActUserID: pull.Poster.ID, ActUser: pull.Poster, |