set from_webhook if a builtin slash command overrides username or icon (#8143)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
4f4a765e7d
Коммит
b34384dbad
@@ -274,28 +274,34 @@ func (a *App) HandleCommandResponse(command *model.Command, args *model.CommandA
|
|||||||
post.Type = response.Type
|
post.Type = response.Type
|
||||||
post.Props = response.Props
|
post.Props = response.Props
|
||||||
|
|
||||||
if !builtIn {
|
isBotPost := !builtIn
|
||||||
post.AddProp("from_webhook", "true")
|
|
||||||
}
|
|
||||||
|
|
||||||
if a.Config().ServiceSettings.EnablePostUsernameOverride {
|
if a.Config().ServiceSettings.EnablePostUsernameOverride {
|
||||||
if len(command.Username) != 0 {
|
if len(command.Username) != 0 {
|
||||||
post.AddProp("override_username", command.Username)
|
post.AddProp("override_username", command.Username)
|
||||||
|
isBotPost = true
|
||||||
} else if len(response.Username) != 0 {
|
} else if len(response.Username) != 0 {
|
||||||
post.AddProp("override_username", response.Username)
|
post.AddProp("override_username", response.Username)
|
||||||
|
isBotPost = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.Config().ServiceSettings.EnablePostIconOverride {
|
if a.Config().ServiceSettings.EnablePostIconOverride {
|
||||||
if len(command.IconURL) != 0 {
|
if len(command.IconURL) != 0 {
|
||||||
post.AddProp("override_icon_url", command.IconURL)
|
post.AddProp("override_icon_url", command.IconURL)
|
||||||
|
isBotPost = true
|
||||||
} else if len(response.IconURL) != 0 {
|
} else if len(response.IconURL) != 0 {
|
||||||
post.AddProp("override_icon_url", response.IconURL)
|
post.AddProp("override_icon_url", response.IconURL)
|
||||||
|
isBotPost = true
|
||||||
} else {
|
} else {
|
||||||
post.AddProp("override_icon_url", "")
|
post.AddProp("override_icon_url", "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isBotPost {
|
||||||
|
post.AddProp("from_webhook", "true")
|
||||||
|
}
|
||||||
|
|
||||||
// Process Slack text replacements
|
// Process Slack text replacements
|
||||||
response.Text = a.ProcessSlackText(response.Text)
|
response.Text = a.ProcessSlackText(response.Text)
|
||||||
response.Attachments = a.ProcessSlackAttachments(response.Attachments)
|
response.Attachments = a.ProcessSlackAttachments(response.Attachments)
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user