Skip to content

Commit 09badd5

Browse files
guillep2klunny
authored andcommitted
Add reviewrs as participants (#8121)
1 parent 418be61 commit 09badd5

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

models/issue.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ func getParticipantsByIssueID(e Engine, issueID int64) ([]*User, error) {
14551455
userIDs := make([]int64, 0, 5)
14561456
if err := e.Table("comment").Cols("poster_id").
14571457
Where("`comment`.issue_id = ?", issueID).
1458-
And("`comment`.type = ?", CommentTypeComment).
1458+
And("`comment`.type in (?,?,?)", CommentTypeComment, CommentTypeCode, CommentTypeReview).
14591459
And("`user`.is_active = ?", true).
14601460
And("`user`.prohibit_login = ?", false).
14611461
Join("INNER", "`user`", "`user`.id = `comment`.poster_id").

routers/repo/issue.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -803,17 +803,7 @@ func ViewIssue(ctx *context.Context) {
803803
return
804804
}
805805
marked[comment.PosterID] = comment.ShowTag
806-
807-
isAdded := false
808-
for j := range participants {
809-
if comment.Poster == participants[j] {
810-
isAdded = true
811-
break
812-
}
813-
}
814-
if !isAdded && !issue.IsPoster(comment.Poster.ID) {
815-
participants = append(participants, comment.Poster)
816-
}
806+
participants = addParticipant(comment.Poster, participants)
817807
} else if comment.Type == models.CommentTypeLabel {
818808
if err = comment.LoadLabel(); err != nil {
819809
ctx.ServerError("LoadLabel", err)
@@ -849,6 +839,7 @@ func ViewIssue(ctx *context.Context) {
849839
ctx.ServerError("LoadReview", err)
850840
return
851841
}
842+
participants = addParticipant(comment.Poster, participants)
852843
if comment.Review == nil {
853844
continue
854845
}
@@ -1571,3 +1562,12 @@ func ChangeCommentReaction(ctx *context.Context, form auth.ReactionForm) {
15711562
"html": html,
15721563
})
15731564
}
1565+
1566+
func addParticipant(poster *models.User, participants []*models.User) []*models.User {
1567+
for _, part := range participants {
1568+
if poster.ID == part.ID {
1569+
return participants
1570+
}
1571+
}
1572+
return append(participants, poster)
1573+
}

0 commit comments

Comments
 (0)