From 2cc1ee3fc0573c3b7c895cb8ed16a74d710873bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Tue, 19 Jan 2016 14:04:24 +0100 Subject: [PATCH] Implemented participant-listing for issue-pages --- routers/repo/issue.go | 24 +++++++++++++++++++----- templates/repo/issue/view_content.tmpl | 13 +++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index a4efb68024..db55033f8a 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -589,12 +589,13 @@ func ViewIssue(ctx *middleware.Context) { } var ( - tag models.CommentTag - ok bool - marked = make(map[int64]models.CommentTag) - comment *models.Comment + tag models.CommentTag + ok bool + marked = make(map[int64]models.CommentTag) + comment *models.Comment + participants []*models.User ) - // Render comments. + // Render comments. (and fetch participants) for _, comment = range issue.Comments { if comment.Type == models.COMMENT_TYPE_COMMENT { comment.RenderedContent = string(base.RenderMarkdown([]byte(comment.Content), ctx.Repo.RepoLink, @@ -617,9 +618,22 @@ func ViewIssue(ctx *middleware.Context) { } marked[comment.PosterID] = comment.ShowTag + + already_added := false + for j := range participants { + if comment.Poster == participants[j] { + already_added = true + } + } + if !already_added { + participants = append(participants, comment.Poster) + } } } + ctx.Data["Participants"] = participants + + ctx.Data["Issue"] = issue ctx.Data["IsIssueOwner"] = ctx.Repo.IsAdmin() || (ctx.IsSigned && issue.IsPoster(ctx.User.Id)) ctx.Data["SignInLink"] = setting.AppSubUrl + "/user/login" diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index c641d7a8ff..20baec0ef3 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -313,6 +313,19 @@ {{end}} + +
+ +
+ {{len .Participants }} Participants +
+ {{range .Participants}} + + + + {{end}} +
+