summaryrefslogtreecommitdiffstats
path: root/model/slack_attachment.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-08-03 18:25:47 -0500
committerChristopher Speller <crspeller@gmail.com>2017-08-03 16:25:47 -0700
commitdf1ff4ec977b76587dfc50885874f08fd9748071 (patch)
tree3481e612ca9b885509f8332ac1f84ee46d1e9756 /model/slack_attachment.go
parentdc884983e625fb7a9309361de26b7dcbc0fd736a (diff)
downloadchat-df1ff4ec977b76587dfc50885874f08fd9748071.tar.gz
chat-df1ff4ec977b76587dfc50885874f08fd9748071.tar.bz2
chat-df1ff4ec977b76587dfc50885874f08fd9748071.zip
PLT-7212: fix missing webhook post attachments (#7011)
* fix missing webhook post attachments * make ProcessSlackAttachments return a new slice instead of modifying it
Diffstat (limited to 'model/slack_attachment.go')
-rw-r--r--model/slack_attachment.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/model/slack_attachment.go b/model/slack_attachment.go
index a3199c44c..855838214 100644
--- a/model/slack_attachment.go
+++ b/model/slack_attachment.go
@@ -33,8 +33,6 @@ type SlackAttachmentField struct {
Short bool `json:"short"`
}
-type SlackAttachments []*SlackAttachment
-
// To mention @channel via a webhook in Slack, the message should contain
// <!channel>, as explained at the bottom of this article:
// https://get.slack.help/hc/en-us/articles/202009646-Making-announcements
@@ -51,9 +49,9 @@ func ExpandAnnouncement(text string) string {
// can be found in the text attribute, or in the pretext, text, title and value
// attributes of the attachment structure. The Slack attachment structure is
// documented here: https://api.slack.com/docs/attachments
-func (a *SlackAttachments) Process() {
+func ProcessSlackAttachments(a []*SlackAttachment) []*SlackAttachment {
var nonNilAttachments []*SlackAttachment
- for _, attachment := range *a {
+ for _, attachment := range a {
if attachment == nil {
continue
}
@@ -77,5 +75,5 @@ func (a *SlackAttachments) Process() {
}
attachment.Fields = nonNilFields
}
- *a = nonNilAttachments
+ return nonNilAttachments
}