plt-2610 allow slash command to override username/icon_url (#4378)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
11b0f64c60
Коммит
be74ec2241
@@ -231,6 +231,8 @@ func handleResponse(c *Context, w http.ResponseWriter, response *model.CommandRe
|
|||||||
if utils.Cfg.ServiceSettings.EnablePostUsernameOverride {
|
if utils.Cfg.ServiceSettings.EnablePostUsernameOverride {
|
||||||
if len(cmd.Username) != 0 {
|
if len(cmd.Username) != 0 {
|
||||||
post.AddProp("override_username", cmd.Username)
|
post.AddProp("override_username", cmd.Username)
|
||||||
|
} else if len(response.Username) != 0 {
|
||||||
|
post.AddProp("override_username", response.Username)
|
||||||
} else {
|
} else {
|
||||||
post.AddProp("override_username", model.DEFAULT_WEBHOOK_USERNAME)
|
post.AddProp("override_username", model.DEFAULT_WEBHOOK_USERNAME)
|
||||||
}
|
}
|
||||||
@@ -239,6 +241,8 @@ func handleResponse(c *Context, w http.ResponseWriter, response *model.CommandRe
|
|||||||
if utils.Cfg.ServiceSettings.EnablePostIconOverride {
|
if utils.Cfg.ServiceSettings.EnablePostIconOverride {
|
||||||
if len(cmd.IconURL) != 0 {
|
if len(cmd.IconURL) != 0 {
|
||||||
post.AddProp("override_icon_url", cmd.IconURL)
|
post.AddProp("override_icon_url", cmd.IconURL)
|
||||||
|
} else if len(response.IconURL) != 0 {
|
||||||
|
post.AddProp("override_icon_url", response.IconURL)
|
||||||
} else {
|
} else {
|
||||||
post.AddProp("override_icon_url", "")
|
post.AddProp("override_icon_url", "")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ const (
|
|||||||
type CommandResponse struct {
|
type CommandResponse struct {
|
||||||
ResponseType string `json:"response_type"`
|
ResponseType string `json:"response_type"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
|
Username string `json:"username"`
|
||||||
|
IconURL string `json:"icon_url"`
|
||||||
GotoLocation string `json:"goto_location"`
|
GotoLocation string `json:"goto_location"`
|
||||||
Attachments interface{} `json:"attachments"`
|
Attachments interface{} `json:"attachments"`
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user