mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00:00 
			
		
		
		
	Add reviewrs as participants (#8124)
This commit is contained in:
		
				
					committed by
					
						 techknowlogick
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							c4d8d53a6d
						
					
				
				
					commit
					b228d22736
				
			| @@ -1446,7 +1446,7 @@ func getParticipantsByIssueID(e Engine, issueID int64) ([]*User, error) { | |||||||
| 	userIDs := make([]int64, 0, 5) | 	userIDs := make([]int64, 0, 5) | ||||||
| 	if err := e.Table("comment").Cols("poster_id"). | 	if err := e.Table("comment").Cols("poster_id"). | ||||||
| 		Where("`comment`.issue_id = ?", issueID). | 		Where("`comment`.issue_id = ?", issueID). | ||||||
| 		And("`comment`.type = ?", CommentTypeComment). | 		And("`comment`.type in (?,?,?)", CommentTypeComment, CommentTypeCode, CommentTypeReview). | ||||||
| 		And("`user`.is_active = ?", true). | 		And("`user`.is_active = ?", true). | ||||||
| 		And("`user`.prohibit_login = ?", false). | 		And("`user`.prohibit_login = ?", false). | ||||||
| 		Join("INNER", "`user`", "`user`.id = `comment`.poster_id"). | 		Join("INNER", "`user`", "`user`.id = `comment`.poster_id"). | ||||||
|   | |||||||
| @@ -805,17 +805,7 @@ func ViewIssue(ctx *context.Context) { | |||||||
| 				return | 				return | ||||||
| 			} | 			} | ||||||
| 			marked[comment.PosterID] = comment.ShowTag | 			marked[comment.PosterID] = comment.ShowTag | ||||||
|  | 			participants = addParticipant(comment.Poster, participants) | ||||||
| 			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) |  | ||||||
| 			} |  | ||||||
| 		} else if comment.Type == models.CommentTypeLabel { | 		} else if comment.Type == models.CommentTypeLabel { | ||||||
| 			if err = comment.LoadLabel(); err != nil { | 			if err = comment.LoadLabel(); err != nil { | ||||||
| 				ctx.ServerError("LoadLabel", err) | 				ctx.ServerError("LoadLabel", err) | ||||||
| @@ -851,6 +841,7 @@ func ViewIssue(ctx *context.Context) { | |||||||
| 				ctx.ServerError("LoadReview", err) | 				ctx.ServerError("LoadReview", err) | ||||||
| 				return | 				return | ||||||
| 			} | 			} | ||||||
|  | 			participants = addParticipant(comment.Poster, participants) | ||||||
| 			if comment.Review == nil { | 			if comment.Review == nil { | ||||||
| 				continue | 				continue | ||||||
| 			} | 			} | ||||||
| @@ -1573,3 +1564,12 @@ func ChangeCommentReaction(ctx *context.Context, form auth.ReactionForm) { | |||||||
| 		"html": html, | 		"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) | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user