mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-10 03:10:26 +00:00
Hint at thread replies when messages are unthreaded (slack) (#684)
This commit is contained in:
parent
2cfd880cdb
commit
57f156be83
@ -254,6 +254,13 @@ func (b *Bslack) populateReceivedMessage(ev *slack.MessageEvent) (*config.Messag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For edits, only submessage has thread ts.
|
||||||
|
// Ensures edits to threaded messages maintain their prefix hint on the
|
||||||
|
// unthreaded end.
|
||||||
|
if ev.SubMessage != nil {
|
||||||
|
rmsg.ParentID = ev.SubMessage.ThreadTimestamp
|
||||||
|
}
|
||||||
|
|
||||||
if err = b.populateMessageWithUserInfo(ev, rmsg); err != nil {
|
if err = b.populateMessageWithUserInfo(ev, rmsg); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -293,6 +293,12 @@ func (b *Bslack) sendRTM(msg config.Message) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle prefix hint for unthreaded messages.
|
||||||
|
if msg.ParentID == "msg-parent-not-found" {
|
||||||
|
msg.ParentID = ""
|
||||||
|
msg.Text = fmt.Sprintf("[thread]: %s", msg.Text)
|
||||||
|
}
|
||||||
|
|
||||||
// Handle message deletions.
|
// Handle message deletions.
|
||||||
if handled, err = b.deleteMessage(&msg, channelInfo); handled {
|
if handled, err = b.deleteMessage(&msg, channelInfo); handled {
|
||||||
return msg.ID, err
|
return msg.ID, err
|
||||||
|
@ -398,6 +398,12 @@ func (gw *Gateway) SendMessage(origmsg config.Message, dest *bridge.Bridge, chan
|
|||||||
msg.ParentID = canonicalParentMsgID
|
msg.ParentID = canonicalParentMsgID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the parentID is still empty and we have a parentID set in the original message
|
||||||
|
// this means that we didn't find it in the cache so set it "msg-parent-not-found"
|
||||||
|
if msg.ParentID == "" && origmsg.ParentID != "" {
|
||||||
|
msg.ParentID = "msg-parent-not-found"
|
||||||
|
}
|
||||||
|
|
||||||
// if we are using mattermost plugin account, send messages to MattermostPlugin channel
|
// if we are using mattermost plugin account, send messages to MattermostPlugin channel
|
||||||
// that can be picked up by the mattermost matterbridge plugin
|
// that can be picked up by the mattermost matterbridge plugin
|
||||||
if dest.Account == "mattermost.plugin" {
|
if dest.Account == "mattermost.plugin" {
|
||||||
|
Loading…
Reference in New Issue
Block a user