summaryrefslogtreecommitdiffstats
path: root/models/webhook_discord.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-02-17 21:12:39 +0000
committerGitHub <noreply@github.com>2019-02-17 21:12:39 +0000
commit11e316654e523bd668a20e1e6a95da3f5b9b22de (patch)
tree2b5aa52929ccb9052127893e37967c3187adcf67 /models/webhook_discord.go
parent8d3bb86e20102c52427befa9cb035c2162d9e7da (diff)
downloadgitea-11e316654e523bd668a20e1e6a95da3f5b9b22de.tar.gz
gitea-11e316654e523bd668a20e1e6a95da3f5b9b22de.zip
Fix deadlock in webhook PullRequest (#6102)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models/webhook_discord.go')
-rw-r--r--models/webhook_discord.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/models/webhook_discord.go b/models/webhook_discord.go
index 4011880ea9..893e780965 100644
--- a/models/webhook_discord.go
+++ b/models/webhook_discord.go
@@ -347,12 +347,13 @@ func getDiscordPullRequestPayload(p *api.PullRequestPayload, meta *DiscordMeta)
text = p.PullRequest.Body
color = warnColor
case api.HookIssueAssigned:
- list, err := MakeAssigneeList(&Issue{ID: p.PullRequest.ID})
- if err != nil {
- return &DiscordPayload{}, err
+ list := make([]string, len(p.PullRequest.Assignees))
+ for i, user := range p.PullRequest.Assignees {
+ list[i] = user.UserName
}
- title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d %s", p.Repository.FullName,
- list, p.Index, p.PullRequest.Title)
+ title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d by %s", p.Repository.FullName,
+ strings.Join(list, ", "),
+ p.Index, p.PullRequest.Title)
text = p.PullRequest.Body
color = successColor
case api.HookIssueUnassigned: