mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	UpdateIssueUsersByMentions was calling database write operations while (#443)
a transaction session was in progress. MailParticipants was failing silently because of the SQLITE_LOCKED error. Make sure failures in MailParticipants enter the log, and pass on the transaction context. issue: let caller pass in database context, and use it issue_comment: obtain database context to pass to UpdateIssueMentions issue_comment: log any error from call to MailParticipants issue_mail: pass on database context to UpdateIssueMentions
This commit is contained in:
		@@ -187,9 +187,9 @@ func (c *Comment) EventTag() string {
 | 
			
		||||
 | 
			
		||||
// MailParticipants sends new comment emails to repository watchers
 | 
			
		||||
// and mentioned people.
 | 
			
		||||
func (c *Comment) MailParticipants(opType ActionType, issue *Issue) (err error) {
 | 
			
		||||
func (c *Comment) MailParticipants(e Engine, opType ActionType, issue *Issue) (err error) {
 | 
			
		||||
	mentions := markdown.FindAllMentions(c.Content)
 | 
			
		||||
	if err = UpdateIssueMentions(c.IssueID, mentions); err != nil {
 | 
			
		||||
	if err = UpdateIssueMentions(e, c.IssueID, mentions); err != nil {
 | 
			
		||||
		return fmt.Errorf("UpdateIssueMentions [%d]: %v", c.IssueID, err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -303,7 +303,9 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
 | 
			
		||||
		if err = notifyWatchers(e, act); err != nil {
 | 
			
		||||
			log.Error(4, "notifyWatchers: %v", err)
 | 
			
		||||
		}
 | 
			
		||||
		comment.MailParticipants(act.OpType, opts.Issue)
 | 
			
		||||
		if err = comment.MailParticipants(e, act.OpType, opts.Issue); err != nil {
 | 
			
		||||
			log.Error(4, "MailParticipants: %v", err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return comment, nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user