diff options
author | Unknwon <u@gogs.io> | 2015-12-10 11:18:56 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-10 11:18:56 -0500 |
commit | c6083c335e53a860fd4c500a86dcdda49a16515e (patch) | |
tree | 2b7699e3c59a0efeabacd00318df475c4534658a /routers | |
parent | 2e9c4ddedb9d4e585b095d066362e78bf8bff6aa (diff) | |
download | gitea-c6083c335e53a860fd4c500a86dcdda49a16515e.tar.gz gitea-c6083c335e53a860fd4c500a86dcdda49a16515e.zip |
#1612 Ability to send mail when a new pull request is submitted
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/issue.go | 8 | ||||
-rw-r--r-- | routers/repo/pull.go | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index ed9454440a..45e63dd9c3 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -343,8 +343,8 @@ func ValidateRepoMetas(ctx *middleware.Context, form auth.CreateIssueForm) ([]in return labelIDs, milestoneID, assigneeID } -func checkMentions(ctx *middleware.Context, issue *models.Issue) { - // Update mentions. +func notifyWatchersAndMentions(ctx *middleware.Context, issue *models.Issue) { + // Update mentions mentions := base.MentionPattern.FindAllString(issue.Content, -1) if len(mentions) > 0 { for i := range mentions { @@ -423,7 +423,7 @@ func NewIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) { return } - checkMentions(ctx, issue) + notifyWatchersAndMentions(ctx, issue) if ctx.Written() { return } @@ -871,7 +871,7 @@ func NewComment(ctx *middleware.Context, form auth.CreateCommentForm) { return } - checkMentions(ctx, &models.Issue{ + notifyWatchersAndMentions(ctx, &models.Issue{ ID: issue.ID, Index: issue.Index, Name: issue.Name, diff --git a/routers/repo/pull.go b/routers/repo/pull.go index d8163a4078..d0c1cb6703 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -634,6 +634,11 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor return } + notifyWatchersAndMentions(ctx, pull) + if ctx.Written() { + return + } + log.Trace("Pull request created: %d/%d", repo.ID, pull.ID) ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pull.Index)) } |