summaryrefslogtreecommitdiffstats
path: root/app/command.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2018-01-23 13:26:31 -0600
committerChristopher Speller <crspeller@gmail.com>2018-01-23 11:26:31 -0800
commitb34384dbadf209d73c455874a5081ff60085687e (patch)
tree6bb08819d0e07b2bf83c0aa3939519395cd79518 /app/command.go
parent4f4a765e7d0bbfdfecc0c52ae4be35f8d3b737ca (diff)
downloadchat-b34384dbadf209d73c455874a5081ff60085687e.tar.gz
chat-b34384dbadf209d73c455874a5081ff60085687e.tar.bz2
chat-b34384dbadf209d73c455874a5081ff60085687e.zip
set from_webhook if a builtin slash command overrides username or icon (#8143)
Diffstat (limited to 'app/command.go')
-rw-r--r--app/command.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/command.go b/app/command.go
index 4c26eae71..fa9b38bf3 100644
--- a/app/command.go
+++ b/app/command.go
@@ -274,28 +274,34 @@ func (a *App) HandleCommandResponse(command *model.Command, args *model.CommandA
post.Type = response.Type
post.Props = response.Props
- if !builtIn {
- post.AddProp("from_webhook", "true")
- }
+ isBotPost := !builtIn
if a.Config().ServiceSettings.EnablePostUsernameOverride {
if len(command.Username) != 0 {
post.AddProp("override_username", command.Username)
+ isBotPost = true
} else if len(response.Username) != 0 {
post.AddProp("override_username", response.Username)
+ isBotPost = true
}
}
if a.Config().ServiceSettings.EnablePostIconOverride {
if len(command.IconURL) != 0 {
post.AddProp("override_icon_url", command.IconURL)
+ isBotPost = true
} else if len(response.IconURL) != 0 {
post.AddProp("override_icon_url", response.IconURL)
+ isBotPost = true
} else {
post.AddProp("override_icon_url", "")
}
}
+ if isBotPost {
+ post.AddProp("from_webhook", "true")
+ }
+
// Process Slack text replacements
response.Text = a.ProcessSlackText(response.Text)
response.Attachments = a.ProcessSlackAttachments(response.Attachments)