diff options
Diffstat (limited to 'bridge/mattermost/mattermost.go')
-rw-r--r-- | bridge/mattermost/mattermost.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bridge/mattermost/mattermost.go b/bridge/mattermost/mattermost.go index e41b19d7..2c11b79e 100644 --- a/bridge/mattermost/mattermost.go +++ b/bridge/mattermost/mattermost.go @@ -127,6 +127,15 @@ func (b *Bmattermost) Send(msg config.Message) (string, error) { msg.Text = fmt.Sprintf("[thread]: %s", msg.Text) } + // we only can reply to the root of the thread, not to a specific ID (like discord for example does) + if msg.ParentID != "" { + post, res := b.mc.Client.GetPost(msg.ParentID, "") + if res.Error != nil { + b.Log.Errorf("getting post %s failed: %s", msg.ParentID, res.Error.DetailedError) + } + msg.ParentID = post.RootId + } + // Upload a file if it exists if msg.Extra != nil { for _, rmsg := range helper.HandleExtra(&msg, b.General) { |