From d2c02be3a00f1e0f05f1ed089dfa8b3e5a0a5538 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 16 Jun 2018 00:11:15 +0200 Subject: [PATCH] Handle slack attachments sent to mattermost. Closes #447 --- bridge/mattermost/mattermost.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index 14c71af4..d828c4d1 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -221,6 +221,18 @@ func (b *Bmattermost) handleMatterClient(messages chan *config.Message) { } if _, ok := props["attachments"].([]interface{}); ok { rmsg.Extra["attachments"] = props["attachments"].([]interface{}) + if rmsg.Text == "" { + for _, attachment := range rmsg.Extra["attachments"] { + attach := attachment.(map[string]interface{}) + if attach["text"].(string) != "" { + rmsg.Text += attach["text"].(string) + continue + } + if attach["fallback"].(string) != "" { + rmsg.Text += attach["fallback"].(string) + } + } + } } }