diff options
author | Unknwon <u@gogs.io> | 2016-07-16 00:36:39 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-07-16 00:36:39 +0800 |
commit | f1b8d52eb3ac230ed5a275f4a844ddb0cf48041e (patch) | |
tree | 51dda05a9fb7a985a4e91f3e1708ffddf3fee19c /routers/repo | |
parent | 7ca5f8f119593023809e6130db75154597c52426 (diff) | |
download | gitea-f1b8d52eb3ac230ed5a275f4a844ddb0cf48041e.tar.gz gitea-f1b8d52eb3ac230ed5a275f4a844ddb0cf48041e.zip |
#2854 fix no mail notification when issue is closed/reopened
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/issue.go | 55 | ||||
-rw-r--r-- | routers/repo/pull.go | 3 | ||||
-rw-r--r-- | routers/repo/setting.go | 6 |
3 files changed, 1 insertions, 63 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 4f75532b3d..accf51d1ec 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -22,7 +22,6 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/markdown" "github.com/gogits/gogs/modules/setting" ) @@ -395,46 +394,6 @@ func ValidateRepoMetas(ctx *context.Context, form auth.CreateIssueForm) ([]int64 return labelIDs, milestoneID, assigneeID } -func MailWatchersAndMentions(ctx *context.Context, issue *models.Issue) error { - // Update mentions - mentions := markdown.MentionPattern.FindAllString(issue.Content, -1) - if len(mentions) > 0 { - for i := range mentions { - mentions[i] = strings.TrimSpace(mentions[i])[1:] - } - - if err := models.UpdateMentions(mentions, issue.ID); err != nil { - return fmt.Errorf("UpdateMentions: %v", err) - } - } - - repo := ctx.Repo.Repository - - // Mail watchers and mentions. - if setting.Service.EnableNotifyMail { - tos, err := mailer.SendIssueNotifyMail(ctx.User, ctx.Repo.Owner, repo, issue) - if err != nil { - return fmt.Errorf("SendIssueNotifyMail: %v", err) - } - - tos = append(tos, ctx.User.LowerName) - newTos := make([]string, 0, len(mentions)) - for _, m := range mentions { - if com.IsSliceContainsStr(tos, m) { - continue - } - - newTos = append(newTos, m) - } - if err = mailer.SendIssueMentionMail(ctx.Render, ctx.User, ctx.Repo.Owner, - repo, issue, models.GetUserEmailsByNames(newTos)); err != nil { - return fmt.Errorf("SendIssueMentionMail: %v", err) - } - } - - return nil -} - func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) { ctx.Data["Title"] = ctx.Tr("repo.issues.new") ctx.Data["PageIsIssueList"] = true @@ -471,9 +430,6 @@ func NewIssuePost(ctx *context.Context, form auth.CreateIssueForm) { if err := models.NewIssue(repo, issue, labelIDs, attachments); err != nil { ctx.Handle(500, "NewIssue", err) return - } else if err := MailWatchersAndMentions(ctx, issue); err != nil { - ctx.Handle(500, "MailWatchersAndMentions", err) - return } log.Trace("Issue created: %d/%d", repo.ID, issue.ID) @@ -933,16 +889,6 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) { return } - MailWatchersAndMentions(ctx, &models.Issue{ - ID: issue.ID, - Index: issue.Index, - Name: issue.Name, - Content: form.Content, - }) - if ctx.Written() { - return - } - log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID) } @@ -1024,7 +970,6 @@ func UpdateLabel(ctx *context.Context, form auth.CreateLabelForm) { return } - fmt.Println(form.Title, form.Color) l.Name = form.Title l.Color = form.Color if err := models.UpdateLabel(l); err != nil { diff --git a/routers/repo/pull.go b/routers/repo/pull.go index da1ee14996..56245a8766 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -681,9 +681,6 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm) } else if err := pullRequest.PushToBaseRepo(); err != nil { ctx.Handle(500, "PushToBaseRepo", err) return - } else if err := MailWatchersAndMentions(ctx, pullIssue); err != nil { - ctx.Handle(500, "MailWatchersAndMentions", err) - return } log.Trace("Pull request created: %d/%d", repo.ID, pullIssue.ID) diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 6fd195aa10..c9236a5331 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -15,7 +15,6 @@ import ( "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/context" "github.com/gogits/gogs/modules/log" - "github.com/gogits/gogs/modules/mailer" "github.com/gogits/gogs/modules/setting" ) @@ -325,10 +324,7 @@ func CollaborationPost(ctx *context.Context) { } if setting.Service.EnableNotifyMail { - if err = mailer.SendCollaboratorMail(ctx.Render, u, ctx.User, ctx.Repo.Repository); err != nil { - ctx.Handle(500, "SendCollaboratorMail", err) - return - } + models.SendCollaboratorMail(u, ctx.User, ctx.Repo.Repository) } ctx.Flash.Success(ctx.Tr("repo.settings.add_collaborator_success")) |