summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2019-09-07 11:53:35 -0300
committerLunny Xiao <xiaolunwen@gmail.com>2019-09-07 22:53:35 +0800
commit09badd55dd25a9b372e4a2e34bbe6bfcbfa0189a (patch)
treef8f8da656ab8491ab4b7250f7850621e661919da /routers
parent418be61040dd05f2e058f5bc20697c1fe177cf75 (diff)
downloadgitea-09badd55dd25a9b372e4a2e34bbe6bfcbfa0189a.tar.gz
gitea-09badd55dd25a9b372e4a2e34bbe6bfcbfa0189a.zip
Add reviewrs as participants (#8121)
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/issue.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index a865bd0ad1..dc09a650fe 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -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)
+}