mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Rewrite delivery of issue and comment mails (#9009)
* Mail issue subscribers, rework the function * Simplify a little more * Fix unused variable * Refactor mail delivery to avoid heavy load on server * Avoid splitting into too many goroutines * Fix comments and optimize GetMaileableUsersByIDs() * Fix return on errors
This commit is contained in:
		@@ -1219,6 +1219,19 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
 | 
			
		||||
	return issues, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetParticipantsIDsByIssueID returns the IDs of all users who participated in comments of an issue,
 | 
			
		||||
// but skips joining with `user` for performance reasons.
 | 
			
		||||
// User permissions must be verified elsewhere if required.
 | 
			
		||||
func GetParticipantsIDsByIssueID(issueID int64) ([]int64, error) {
 | 
			
		||||
	userIDs := make([]int64, 0, 5)
 | 
			
		||||
	return userIDs, x.Table("comment").
 | 
			
		||||
		Cols("poster_id").
 | 
			
		||||
		Where("issue_id = ?", issueID).
 | 
			
		||||
		And("type in (?,?,?)", CommentTypeComment, CommentTypeCode, CommentTypeReview).
 | 
			
		||||
		Distinct("poster_id").
 | 
			
		||||
		Find(&userIDs)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetParticipantsByIssueID returns all users who are participated in comments of an issue.
 | 
			
		||||
func GetParticipantsByIssueID(issueID int64) ([]*User, error) {
 | 
			
		||||
	return getParticipantsByIssueID(x, issueID)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user