summaryrefslogtreecommitdiffstats
path: root/modules/webhook/slack.go
diff options
context:
space:
mode:
authorCornel <github@codejuggle.dj>2020-06-26 04:19:11 +0300
committerGitHub <noreply@github.com>2020-06-25 21:19:11 -0400
commit445992d929aa694975db2a7c44975961ece8977b (patch)
tree6d7a52306a748235602dee8e2b900437610b6dd7 /modules/webhook/slack.go
parentd059156c3a000441de1a040721877060277eb9fe (diff)
downloadgitea-445992d929aa694975db2a7c44975961ece8977b.tar.gz
gitea-445992d929aa694975db2a7c44975961ece8977b.zip
Fix comments webhook panic backport (#12058)
* Handle HookIssueReviewed action in webhook * Fix webhook comment handling type cast panic
Diffstat (limited to 'modules/webhook/slack.go')
-rw-r--r--modules/webhook/slack.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/webhook/slack.go b/modules/webhook/slack.go
index 1e9413efd6..4177bd1250 100644
--- a/modules/webhook/slack.go
+++ b/modules/webhook/slack.go
@@ -321,7 +321,11 @@ func GetSlackPayload(p api.Payloader, event models.HookEventType, meta string) (
case models.HookEventIssues, models.HookEventIssueAssign, models.HookEventIssueLabel, models.HookEventIssueMilestone:
return getSlackIssuesPayload(p.(*api.IssuePayload), slack)
case models.HookEventIssueComment, models.HookEventPullRequestComment:
- return getSlackIssueCommentPayload(p.(*api.IssueCommentPayload), slack)
+ pl, ok := p.(*api.IssueCommentPayload)
+ if ok {
+ return getSlackIssueCommentPayload(pl, slack)
+ }
+ return getSlackPullRequestPayload(p.(*api.PullRequestPayload), slack)
case models.HookEventPush:
return getSlackPushPayload(p.(*api.PushPayload), slack)
case models.HookEventPullRequest, models.HookEventPullRequestAssign, models.HookEventPullRequestLabel,