Skip to content

Commit

Permalink
PLT-3658 Allow webhook response to be created if text does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
yeoji committed Jan 24, 2018
1 parent eed7df0 commit 4bb9c34
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/webhook.go
Expand Up @@ -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
Expand All @@ -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 {
Expand Down

0 comments on commit 4bb9c34

Please sign in to comment.