From ebc35f2b2e700b30d288b622cd9409a0f741e928 Mon Sep 17 00:00:00 2001 From: Cornel Date: Thu, 25 Jun 2020 06:39:43 +0300 Subject: Fix comments webhook panic (#12046) * Fix webhook comment handling type cast panic * Handle HookIssueReviewed action in webhook Co-authored-by: Lunny Xiao --- modules/webhook/msteams.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/webhook/msteams.go') diff --git a/modules/webhook/msteams.go b/modules/webhook/msteams.go index a0925010d6..e7ec396f29 100644 --- a/modules/webhook/msteams.go +++ b/modules/webhook/msteams.go @@ -558,7 +558,11 @@ func GetMSTeamsPayload(p api.Payloader, event models.HookEventType, meta string) case models.HookEventIssues, models.HookEventIssueAssign, models.HookEventIssueLabel, models.HookEventIssueMilestone: return getMSTeamsIssuesPayload(p.(*api.IssuePayload)) case models.HookEventIssueComment, models.HookEventPullRequestComment: - return getMSTeamsIssueCommentPayload(p.(*api.IssueCommentPayload)) + pl, ok := p.(*api.IssueCommentPayload) + if ok { + return getMSTeamsIssueCommentPayload(pl) + } + return getMSTeamsPullRequestPayload(p.(*api.PullRequestPayload)) case models.HookEventPush: return getMSTeamsPushPayload(p.(*api.PushPayload)) case models.HookEventPullRequest, models.HookEventPullRequestAssign, models.HookEventPullRequestLabel, -- cgit v1.2.3