diff options
Diffstat (limited to 'services')
-rw-r--r-- | services/issue/issue.go | 15 | ||||
-rw-r--r-- | services/pull/pull.go | 25 |
2 files changed, 3 insertions, 37 deletions
diff --git a/services/issue/issue.go b/services/issue/issue.go index ee2f176a43..aa06ba4097 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -5,10 +5,7 @@ package issue import ( - "fmt" - "code.gitea.io/gitea/models" - "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/notification" ) @@ -24,18 +21,6 @@ func NewIssue(repo *models.Repository, issue *models.Issue, labelIDs []int64, uu } } - if err := models.NotifyWatchers(&models.Action{ - ActUserID: issue.Poster.ID, - ActUser: issue.Poster, - OpType: models.ActionCreateIssue, - Content: fmt.Sprintf("%d|%s", issue.Index, issue.Title), - RepoID: repo.ID, - Repo: repo, - IsPrivate: repo.IsPrivate, - }); err != nil { - log.Error("NotifyWatchers: %v", err) - } - notification.NotifyNewIssue(issue) return nil diff --git a/services/pull/pull.go b/services/pull/pull.go index 0a4c4a7eee..20939c397f 100644 --- a/services/pull/pull.go +++ b/services/pull/pull.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/notification" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/webhook" issue_service "code.gitea.io/gitea/services/issue" @@ -27,30 +28,10 @@ func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int6 } } - if err := models.NotifyWatchers(&models.Action{ - ActUserID: pull.Poster.ID, - ActUser: pull.Poster, - OpType: models.ActionCreatePullRequest, - Content: fmt.Sprintf("%d|%s", pull.Index, pull.Title), - RepoID: repo.ID, - Repo: repo, - IsPrivate: repo.IsPrivate, - }); err != nil { - log.Error("NotifyWatchers: %v", err) - } - pr.Issue = pull pull.PullRequest = pr - mode, _ := models.AccessLevel(pull.Poster, repo) - if err := webhook.PrepareWebhooks(repo, models.HookEventPullRequest, &api.PullRequestPayload{ - Action: api.HookIssueOpened, - Index: pull.Index, - PullRequest: pr.APIFormat(), - Repository: repo.APIFormat(mode), - Sender: pull.Poster.APIFormat(), - }); err != nil { - log.Error("PrepareWebhooks: %v", err) - } + + notification.NotifyNewPullRequest(pr) return nil } |