]> source.dussan.org Git - gitea.git/commitdiff
Add reviewrs as participants (#8121)
authorguillep2k <18600385+guillep2k@users.noreply.github.com>
Sat, 7 Sep 2019 14:53:35 +0000 (11:53 -0300)
committerLunny Xiao <xiaolunwen@gmail.com>
Sat, 7 Sep 2019 14:53:35 +0000 (22:53 +0800)
models/issue.go
routers/repo/issue.go

index b849f97bd4252870efa3ba832f4b01132372871e..511bfa31c411e5b948bde04bc3f16aae2f4c9985 100644 (file)
@@ -1455,7 +1455,7 @@ func getParticipantsByIssueID(e Engine, issueID int64) ([]*User, error) {
        userIDs := make([]int64, 0, 5)
        if err := e.Table("comment").Cols("poster_id").
                Where("`comment`.issue_id = ?", issueID).
-               And("`comment`.type = ?", CommentTypeComment).
+               And("`comment`.type in (?,?,?)", CommentTypeComment, CommentTypeCode, CommentTypeReview).
                And("`user`.is_active = ?", true).
                And("`user`.prohibit_login = ?", false).
                Join("INNER", "`user`", "`user`.id = `comment`.poster_id").
index a865bd0ad11ed6a1f2f653faf1fbaf0e02fafe96..dc09a650fed7f2f9aa9efbeaeced4721bf7bc117 100644 (file)
@@ -803,17 +803,7 @@ func ViewIssue(ctx *context.Context) {
                                return
                        }
                        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)
-                       }
+                       participants = addParticipant(comment.Poster, participants)
                } else if comment.Type == models.CommentTypeLabel {
                        if err = comment.LoadLabel(); err != nil {
                                ctx.ServerError("LoadLabel", err)
@@ -849,6 +839,7 @@ func ViewIssue(ctx *context.Context) {
                                ctx.ServerError("LoadReview", err)
                                return
                        }
+                       participants = addParticipant(comment.Poster, participants)
                        if comment.Review == nil {
                                continue
                        }
@@ -1571,3 +1562,12 @@ func ChangeCommentReaction(ctx *context.Context, form auth.ReactionForm) {
                "html": html,
        })
 }
+
+func addParticipant(poster *models.User, participants []*models.User) []*models.User {
+       for _, part := range participants {
+               if poster.ID == part.ID {
+                       return participants
+               }
+       }
+       return append(participants, poster)
+}