1
0
Fork 0
forked from forgejo/forgejo

Add mail notify for creating issue

This commit is contained in:
Unknown 2014-03-25 21:37:18 -04:00
parent bc5316b82e
commit c1a3d4fefb
5 changed files with 49 additions and 5 deletions

View file

@ -13,6 +13,7 @@ import (
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/mailer"
"github.com/gogits/gogs/modules/middleware"
)
@ -86,6 +87,14 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat
return
}
// Mail watchers.
if base.Service.NotifyMail {
if err = mailer.SendNotifyMail(ctx.User.Id, ctx.Repo.Repository.Id, ctx.User.Name, ctx.Repo.Repository.Name, issue.Name, issue.Content); err != nil {
ctx.Handle(200, "issue.CreateIssue", err)
return
}
}
log.Trace("%d Issue created: %d", ctx.Repo.Repository.Id, issue.Id)
ctx.Redirect(fmt.Sprintf("/%s/%s/issues/%d", params["username"], params["reponame"], issue.Index))
}