1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-27 12:48:37 +00:00

Backport: Ignore mentions for users with no access (#8395) (#8484)

* Ignore mentions for users with no access

* Fix fmt
This commit is contained in:
guillep2k
2019-10-13 12:17:53 -03:00
committed by zeripath
parent 5c3863c319
commit d93d5d7906
5 changed files with 175 additions and 40 deletions

View File

@@ -387,11 +387,18 @@ func (c *Comment) MailParticipants(opType ActionType, issue *Issue) (err error)
}
func (c *Comment) mailParticipants(e Engine, opType ActionType, issue *Issue) (err error) {
mentions := markup.FindAllMentions(c.Content)
if err = UpdateIssueMentions(e, c.IssueID, mentions); err != nil {
rawMentions := markup.FindAllMentions(c.Content)
userMentions, err := issue.ResolveMentionsByVisibility(e, c.Poster, rawMentions)
if err != nil {
return fmt.Errorf("ResolveMentionsByVisibility [%d]: %v", c.IssueID, err)
}
if err = UpdateIssueMentions(e, c.IssueID, userMentions); err != nil {
return fmt.Errorf("UpdateIssueMentions [%d]: %v", c.IssueID, err)
}
mentions := make([]string, len(userMentions))
for i, u := range userMentions {
mentions[i] = u.LowerName
}
if len(c.Content) > 0 {
if err = mailIssueCommentToParticipants(e, issue, c.Poster, c.Content, c, mentions); err != nil {
log.Error("mailIssueCommentToParticipants: %v", err)