Fix deadlock in webhook PullRequest (#6102)
Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
8d3bb86e20
commit
11e316654e
|
@ -230,12 +230,13 @@ func getDingtalkPullRequestPayload(p *api.PullRequestPayload) (*DingtalkPayload,
|
||||||
title = fmt.Sprintf("[%s] Pull request edited: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
|
title = fmt.Sprintf("[%s] Pull request edited: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
|
||||||
text = p.PullRequest.Body
|
text = p.PullRequest.Body
|
||||||
case api.HookIssueAssigned:
|
case api.HookIssueAssigned:
|
||||||
list, err := MakeAssigneeList(&Issue{ID: p.PullRequest.ID})
|
list := make([]string, len(p.PullRequest.Assignees))
|
||||||
if err != nil {
|
for i, user := range p.PullRequest.Assignees {
|
||||||
return &DingtalkPayload{}, err
|
list[i] = user.UserName
|
||||||
}
|
}
|
||||||
title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d %s", p.Repository.FullName,
|
title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d %s", p.Repository.FullName,
|
||||||
list, p.Index, p.PullRequest.Title)
|
strings.Join(list, ", "),
|
||||||
|
p.Index, p.PullRequest.Title)
|
||||||
text = p.PullRequest.Body
|
text = p.PullRequest.Body
|
||||||
case api.HookIssueUnassigned:
|
case api.HookIssueUnassigned:
|
||||||
title = fmt.Sprintf("[%s] Pull request unassigned: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
|
title = fmt.Sprintf("[%s] Pull request unassigned: #%d %s", p.Repository.FullName, p.Index, p.PullRequest.Title)
|
||||||
|
|
|
@ -347,12 +347,13 @@ func getDiscordPullRequestPayload(p *api.PullRequestPayload, meta *DiscordMeta)
|
||||||
text = p.PullRequest.Body
|
text = p.PullRequest.Body
|
||||||
color = warnColor
|
color = warnColor
|
||||||
case api.HookIssueAssigned:
|
case api.HookIssueAssigned:
|
||||||
list, err := MakeAssigneeList(&Issue{ID: p.PullRequest.ID})
|
list := make([]string, len(p.PullRequest.Assignees))
|
||||||
if err != nil {
|
for i, user := range p.PullRequest.Assignees {
|
||||||
return &DiscordPayload{}, err
|
list[i] = user.UserName
|
||||||
}
|
}
|
||||||
title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d %s", p.Repository.FullName,
|
title = fmt.Sprintf("[%s] Pull request assigned to %s: #%d by %s", p.Repository.FullName,
|
||||||
list, p.Index, p.PullRequest.Title)
|
strings.Join(list, ", "),
|
||||||
|
p.Index, p.PullRequest.Title)
|
||||||
text = p.PullRequest.Body
|
text = p.PullRequest.Body
|
||||||
color = successColor
|
color = successColor
|
||||||
case api.HookIssueUnassigned:
|
case api.HookIssueUnassigned:
|
||||||
|
|
|
@ -301,12 +301,12 @@ func getSlackPullRequestPayload(p *api.PullRequestPayload, slack *SlackMeta) (*S
|
||||||
text = fmt.Sprintf("[%s] Pull request edited: %s by %s", p.Repository.FullName, titleLink, senderLink)
|
text = fmt.Sprintf("[%s] Pull request edited: %s by %s", p.Repository.FullName, titleLink, senderLink)
|
||||||
attachmentText = SlackTextFormatter(p.PullRequest.Body)
|
attachmentText = SlackTextFormatter(p.PullRequest.Body)
|
||||||
case api.HookIssueAssigned:
|
case api.HookIssueAssigned:
|
||||||
list, err := MakeAssigneeList(&Issue{ID: p.PullRequest.ID})
|
list := make([]string, len(p.PullRequest.Assignees))
|
||||||
if err != nil {
|
for i, user := range p.PullRequest.Assignees {
|
||||||
return &SlackPayload{}, err
|
list[i] = SlackLinkFormatter(setting.AppURL+user.UserName, user.UserName)
|
||||||
}
|
}
|
||||||
text = fmt.Sprintf("[%s] Pull request assigned to %s: %s by %s", p.Repository.FullName,
|
text = fmt.Sprintf("[%s] Pull request assigned to %s: %s by %s", p.Repository.FullName,
|
||||||
SlackLinkFormatter(setting.AppURL+list, list),
|
strings.Join(list, ", "),
|
||||||
titleLink, senderLink)
|
titleLink, senderLink)
|
||||||
case api.HookIssueUnassigned:
|
case api.HookIssueUnassigned:
|
||||||
text = fmt.Sprintf("[%s] Pull request unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink)
|
text = fmt.Sprintf("[%s] Pull request unassigned: %s by %s", p.Repository.FullName, titleLink, senderLink)
|
||||||
|
|
Loading…
Reference in a new issue