1
0
Fork 0
forked from forgejo/forgejo

Move issue notifications (#8713)

This commit is contained in:
Lunny Xiao 2019-10-29 00:45:43 +08:00 committed by GitHub
parent e3875ace91
commit af8957bc4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 55 deletions

View file

@ -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,