diff options
author | Wim <wim@42.be> | 2017-03-25 21:04:10 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-03-25 21:04:10 +0100 |
commit | eacb1c1771cec126593f99f50aca4584236475fa (patch) | |
tree | 5ae7d8271c28e378d1d5ca2d0e1e243717a9bdbe /vendor/github.com/mattermost/platform/model/incoming_webhook.go | |
parent | 07fd825349e8b7e86f8afb3843cb8e2c2afc7c74 (diff) | |
download | matterbridge-msglm-eacb1c1771cec126593f99f50aca4584236475fa.tar.gz matterbridge-msglm-eacb1c1771cec126593f99f50aca4584236475fa.tar.bz2 matterbridge-msglm-eacb1c1771cec126593f99f50aca4584236475fa.zip |
Update vendor (mattermost)
Diffstat (limited to 'vendor/github.com/mattermost/platform/model/incoming_webhook.go')
-rw-r--r-- | vendor/github.com/mattermost/platform/model/incoming_webhook.go | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/vendor/github.com/mattermost/platform/model/incoming_webhook.go b/vendor/github.com/mattermost/platform/model/incoming_webhook.go index 72fa3e54..2cc26cbc 100644 --- a/vendor/github.com/mattermost/platform/model/incoming_webhook.go +++ b/vendor/github.com/mattermost/platform/model/incoming_webhook.go @@ -29,13 +29,13 @@ type IncomingWebhook struct { } type IncomingWebhookRequest struct { - Text string `json:"text"` - Username string `json:"username"` - IconURL string `json:"icon_url"` - ChannelName string `json:"channel"` - Props StringInterface `json:"props"` - Attachments interface{} `json:"attachments"` - Type string `json:"type"` + Text string `json:"text"` + Username string `json:"username"` + IconURL string `json:"icon_url"` + ChannelName string `json:"channel"` + Props StringInterface `json:"props"` + Attachments []*SlackAttachment `json:"attachments"` + Type string `json:"type"` } func (o *IncomingWebhook) ToJson() string { @@ -212,31 +212,15 @@ func expandAnnouncement(text string) string { func expandAnnouncements(i *IncomingWebhookRequest) { i.Text = expandAnnouncement(i.Text) - if i.Attachments != nil { - attachments := i.Attachments.([]interface{}) - for _, attachment := range attachments { - a := attachment.(map[string]interface{}) + for _, attachment := range i.Attachments { + attachment.Pretext = expandAnnouncement(attachment.Pretext) + attachment.Text = expandAnnouncement(attachment.Text) + attachment.Title = expandAnnouncement(attachment.Title) - if a["pretext"] != nil { - a["pretext"] = expandAnnouncement(a["pretext"].(string)) - } - - if a["text"] != nil { - a["text"] = expandAnnouncement(a["text"].(string)) - } - - if a["title"] != nil { - a["title"] = expandAnnouncement(a["title"].(string)) - } - - if a["fields"] != nil { - fields := a["fields"].([]interface{}) - for _, field := range fields { - f := field.(map[string]interface{}) - if f["value"] != nil { - f["value"] = expandAnnouncement(fmt.Sprintf("%v", f["value"])) - } - } + for _, field := range attachment.Fields { + if field.Value != nil { + // Ensure the value is set to a string if it is set + field.Value = expandAnnouncement(fmt.Sprintf("%v", field.Value)) } } } |