diff options
author | Unknwon <u@gogs.io> | 2016-02-01 20:31:54 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-02-01 20:31:54 -0500 |
commit | d3ba2466932aa40b549a563c69c60905a30536b8 (patch) | |
tree | f68fa8232cd88815a06e8c7bcb50f7cd46952ee5 | |
parent | a93af59b363912c00cfbfc3a8af5edb7396036de (diff) | |
parent | 85335c5f5623d3a8d238fcc21ab6a366096434bd (diff) | |
download | gitea-d3ba2466932aa40b549a563c69c60905a30536b8.tar.gz gitea-d3ba2466932aa40b549a563c69c60905a30536b8.zip |
Merge pull request #2444 from bkcsoft/feature/participants
Implemented participant-listing for issue-pages (Fixes #2377)
-rw-r--r-- | routers/repo/issue.go | 24 | ||||
-rw-r--r-- | templates/repo/issue/view_content.tmpl | 16 |
2 files changed, 35 insertions, 5 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index b031e42ce7..3c1f62c207 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -591,12 +591,14 @@ 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. + participants = append(participants, issue.Poster) + // 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, @@ -619,9 +621,21 @@ func ViewIssue(ctx *middleware.Context) { } marked[comment.PosterID] = comment.ShowTag + + isAdded := false + for j := range participants { + if comment.Poster == participants[j] { + isAdded = true + break + } + } + if !isAdded && !issue.IsPoster(comment.Poster.Id) { + 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..0c1c2690d8 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -313,6 +313,22 @@ {{end}} </div> </div> + + <div class="ui divider"></div> + + <div class="ui participants floating jump"> + <span class="text"><strong>{{len .Participants }} Participants</strong></span> + <div class="ui floating jump"> + {{range .Participants}} + <a href="{{.HomeLink}}"> + <img class="ui avatar image" src="{{.AvatarLink}}" data-content={{.FullName}}> + </a> + {{end}} + </div> + <script> + $('.participants .ui.avatar.image').popup(); + </script> + </div> </div> </div> </div> |