From 4bb9c34aa4ba9ab08d17d46aba999691fb34203e Mon Sep 17 00:00:00 2001 From: jq Date: Thu, 25 Jan 2018 02:31:30 +1100 Subject: [PATCH] PLT-3658 Allow webhook response to be created if text does not exist --- app/webhook.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/webhook.go b/app/webhook.go index 857d1607bfa6e..a9bb32f3574db 100644 --- a/app/webhook.go +++ b/app/webhook.go @@ -113,7 +113,7 @@ func (a *App) TriggerWebhook(payload *model.OutgoingWebhookPayload, hook *model. webhookResp := model.OutgoingWebhookResponseFromJson(resp.Body) - if webhookResp != nil && webhookResp.Text != nil { + if webhookResp != nil && (webhookResp.Text != nil || len(webhookResp.Attachments) > 0) { postRootId := "" if webhookResp.ResponseType == model.OUTGOING_HOOK_RESPONSE_TYPE_COMMENT { postRootId = post.Id @@ -123,7 +123,10 @@ func (a *App) TriggerWebhook(payload *model.OutgoingWebhookPayload, hook *model. } webhookResp.Props["webhook_display_name"] = hook.DisplayName - text := a.ProcessSlackText(*webhookResp.Text) + text := "" + if webhookResp.Text != nil { + text = a.ProcessSlackText(*webhookResp.Text) + } webhookResp.Attachments = a.ProcessSlackAttachments(webhookResp.Attachments) // attachments is in here for slack compatibility if len(webhookResp.Attachments) > 0 {