summaryrefslogtreecommitdiffstats
path: root/app/webhook.go
diff options
context:
space:
mode:
authorPradeep Murugesan <pradeepmurugesan@outlook.com>2018-07-25 14:31:41 +0200
committerJesse Hallam <jesse.hallam@gmail.com>2018-07-25 08:31:41 -0400
commitb3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4 (patch)
tree6c4ebe9d5bd20b2923e85b0586c7929682d392c5 /app/webhook.go
parentb89ccca929e67ddd2a8f7ac2e952532bf615a51b (diff)
downloadchat-b3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4.tar.gz
chat-b3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4.tar.bz2
chat-b3c2ecd9b9209413e7272b2fcd7bd3d04f2f85f4.zip
added the custom icon and username for the outgoing webhook and its response (#9141)
* 8272 added the username and icon as part of the model and persisted the same * 8272 added the custome icon and name when set to the web hook response * 8272 changed the infinte loop to timeout after 5 seconds * 8272 fixed review comments
Diffstat (limited to 'app/webhook.go')
-rw-r--r--app/webhook.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/webhook.go b/app/webhook.go
index 8926c94a8..e801b0467 100644
--- a/app/webhook.go
+++ b/app/webhook.go
@@ -133,7 +133,13 @@ func (a *App) TriggerWebhook(payload *model.OutgoingWebhookPayload, hook *model.
if len(webhookResp.Attachments) > 0 {
webhookResp.Props["attachments"] = webhookResp.Attachments
}
+ if a.Config().ServiceSettings.EnablePostUsernameOverride && hook.Username != "" && webhookResp.Username == "" {
+ webhookResp.Username = hook.Username
+ }
+ if a.Config().ServiceSettings.EnablePostIconOverride && hook.IconURL != "" && webhookResp.IconURL == "" {
+ webhookResp.IconURL = hook.IconURL
+ }
if _, err := a.CreateWebhookPost(hook.CreatorId, channel, text, webhookResp.Username, webhookResp.IconURL, webhookResp.Props, webhookResp.Type, postRootId); err != nil {
mlog.Error(fmt.Sprintf("Failed to create response post, err=%v", err))
}