From b33b50987b89676a5fb71476639d488e051315d8 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Wed, 9 Jan 2019 15:50:03 -0500 Subject: Add support for mattermost threading (#627) --- bridge/mattermost/handlers.go | 3 ++- bridge/mattermost/mattermost.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'bridge/mattermost') diff --git a/bridge/mattermost/handlers.go b/bridge/mattermost/handlers.go index d75e8d40..cd625c55 100644 --- a/bridge/mattermost/handlers.go +++ b/bridge/mattermost/handlers.go @@ -104,6 +104,7 @@ func (b *Bmattermost) handleMatterClient(messages chan *config.Message) { Channel: message.Channel, Text: message.Text, ID: message.Post.Id, + ParentID: message.Post.ParentId, Extra: make(map[string][]interface{}), } @@ -163,7 +164,7 @@ func (b *Bmattermost) handleUploadFile(msg *config.Message) (string, error) { if b.GetBool("PrefixMessagesWithNick") { msg.Text = msg.Username + msg.Text } - res, err = b.mc.PostMessageWithFiles(channelID, msg.Text, []string{id}) + res, err = b.mc.PostMessageWithFiles(channelID, msg.Text, msg.ParentID, []string{id}) } return res, err } diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index b0dca0ba..ce4f4c33 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -124,7 +124,7 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) { // Upload a file if it exists if msg.Extra != nil { for _, rmsg := range helper.HandleExtra(&msg, b.General) { - if _, err := b.mc.PostMessage(b.mc.GetChannelId(rmsg.Channel, b.TeamID), rmsg.Username+rmsg.Text); err != nil { + if _, err := b.mc.PostMessage(b.mc.GetChannelId(rmsg.Channel, b.TeamID), rmsg.Username+rmsg.Text, msg.ParentID); err != nil { b.Log.Errorf("PostMessage failed: %s", err) } } @@ -144,5 +144,5 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) { } // Post normal message - return b.mc.PostMessage(b.mc.GetChannelId(msg.Channel, b.TeamID), msg.Text) + return b.mc.PostMessage(b.mc.GetChannelId(msg.Channel, b.TeamID), msg.Text, msg.ParentID) } -- cgit v1.2.3