Skip to content

Commit b228d22

Browse files
guillep2ktechknowlogick
authored andcommitted
Add reviewrs as participants (#8124)
1 parent c4d8d53 commit b228d22

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
@@ -1446,7 +1446,7 @@ func getParticipantsByIssueID(e Engine, issueID int64) ([]*User, error) {
14461446
userIDs := make([]int64, 0, 5)
14471447
if err := e.Table("comment").Cols("poster_id").
14481448
Where("`comment`.issue_id = ?", issueID).
1449-
And("`comment`.type = ?", CommentTypeComment).
1449+
And("`comment`.type in (?,?,?)", CommentTypeComment, CommentTypeCode, CommentTypeReview).
14501450
And("`user`.is_active = ?", true).
14511451
And("`user`.prohibit_login = ?", false).
14521452
Join("INNER", "`user`", "`user`.id = `comment`.poster_id").

routers/repo/issue.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -805,17 +805,7 @@ func ViewIssue(ctx *context.Context) {
805805
return
806806
}
807807
marked[comment.PosterID] = comment.ShowTag
808-
809-
isAdded := false
810-
for j := range participants {
811-
if comment.Poster == participants[j] {
812-
isAdded = true
813-
break
814-
}
815-
}
816-
if !isAdded && !issue.IsPoster(comment.Poster.ID) {
817-
participants = append(participants, comment.Poster)
818-
}
808+
participants = addParticipant(comment.Poster, participants)
819809
} else if comment.Type == models.CommentTypeLabel {
820810
if err = comment.LoadLabel(); err != nil {
821811
ctx.ServerError("LoadLabel", err)
@@ -851,6 +841,7 @@ func ViewIssue(ctx *context.Context) {
851841
ctx.ServerError("LoadReview", err)
852842
return
853843
}
844+
participants = addParticipant(comment.Poster, participants)
854845
if comment.Review == nil {
855846
continue
856847
}
@@ -1573,3 +1564,12 @@ func ChangeCommentReaction(ctx *context.Context, form auth.ReactionForm) {
15731564
"html": html,
15741565
})
15751566
}
1567+
1568+
func addParticipant(poster *models.User, participants []*models.User) []*models.User {
1569+
for _, part := range participants {
1570+
if poster.ID == part.ID {
1571+
return participants
1572+
}
1573+
}
1574+
return append(participants, poster)
1575+
}

0 commit comments

Comments
 (0)