diff options
author | Unknown <joe2010xtmf@163.com> | 2014-04-02 10:38:30 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-04-02 10:38:30 -0400 |
commit | d9005ee970270bca97e81d59edca4722752d160d (patch) | |
tree | 9adeaf4ee547f1b2b7c9a546b1af2c89b007516e /routers/repo | |
parent | b0e7dd6864717841dd218af93dd8bd30d198128d (diff) | |
download | gitea-d9005ee970270bca97e81d59edca4722752d160d.tar.gz gitea-d9005ee970270bca97e81d59edca4722752d160d.zip |
Improve issue mail content
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/issue.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 6cad2c25d2..41b2c7e9b1 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -31,7 +31,8 @@ func Issues(ctx *middleware.Context) { ctx.Data["IssueCreatedCount"] = 0 var posterId int64 = 0 - if ctx.Query("type") == "created_by" { + isCreatedBy := ctx.Query("type") == "created_by" + if isCreatedBy { if !ctx.IsSigned { ctx.SetCookie("redirect_to", "/"+url.QueryEscape(ctx.Req.RequestURI)) ctx.Redirect("/user/login/", 302) @@ -53,6 +54,7 @@ func Issues(ctx *middleware.Context) { } var createdByCount int + showIssues := make([]models.Issue, 0, len(issues)) // Get posters. for i := range issues { u, err := models.GetUserById(issues[i].PosterId) @@ -60,13 +62,17 @@ func Issues(ctx *middleware.Context) { ctx.Handle(200, "issue.Issues(get poster): %v", err) return } - issues[i].Poster = u + if isCreatedBy && u.Id != posterId { + continue + } if u.Id == posterId { createdByCount++ } + issues[i].Poster = u + showIssues = append(showIssues, issues[i]) } - ctx.Data["Issues"] = issues + ctx.Data["Issues"] = showIssues ctx.Data["IssueCount"] = ctx.Repo.Repository.NumIssues ctx.Data["OpenCount"] = ctx.Repo.Repository.NumIssues - ctx.Repo.Repository.NumClosedIssues ctx.Data["ClosedCount"] = ctx.Repo.Repository.NumClosedIssues @@ -107,7 +113,7 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat // 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 { + if err = mailer.SendNotifyMail(ctx.User, ctx.Repo.Owner, ctx.Repo.Repository, issue); err != nil { ctx.Handle(200, "issue.CreateIssue", err) return } |