Merge pull request #1327 from florianorben/PLT-857-2
PLT-857: Support `attachments` for Incoming Webhooks
Этот коммит содержится в:
12
web/web.go
12
web/web.go
@@ -995,6 +995,16 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
channelName := parsedRequest.ChannelName
|
||||
webhookType := parsedRequest.Type
|
||||
|
||||
//attachments is in here for slack compatibility
|
||||
if parsedRequest.Attachments != nil {
|
||||
if len(parsedRequest.Props) == 0 {
|
||||
parsedRequest.Props = make(model.StringInterface)
|
||||
}
|
||||
parsedRequest.Props["attachments"] = parsedRequest.Attachments
|
||||
webhookType = model.POST_SLACK_ATTACHMENT
|
||||
}
|
||||
|
||||
var hook *model.IncomingWebhook
|
||||
if result := <-hchan; result.Err != nil {
|
||||
@@ -1044,7 +1054,7 @@ func incomingWebhook(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := api.CreateWebhookPost(c, channel.Id, text, overrideUsername, overrideIconUrl); err != nil {
|
||||
if _, err := api.CreateWebhookPost(c, channel.Id, text, overrideUsername, overrideIconUrl, parsedRequest.Props, webhookType); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user