Added indication of when replies are unthreaded.

This commit is contained in:
Patrick Connolly
2018-11-17 04:00:27 +08:00
parent f94c2b40a3
commit 17343be4c3

View File

@@ -41,7 +41,8 @@ type BrMsgID struct {
var flog *log.Entry
const (
apiProtocol = "api"
apiProtocol = "api"
threadReplyPrefix = "thread reply"
)
func New(cfg config.Gateway, r *Router) *Gateway {
@@ -288,6 +289,11 @@ func (gw *Gateway) handleMessage(msg config.Message, dest *bridge.Bridge) []*BrM
msg.Channel = originchannel
}
// Add prefix if reply message is being unthreaded.
if msg.ParentID != "" && canonicalParentMsgID == "" {
msg.Text = fmt.Sprintf("%s: %s", threadReplyPrefix, msg.Text)
}
msg.ParentID = gw.getDestMsgID(origmsg.Protocol+" "+canonicalParentMsgID, dest, channel)
if msg.ParentID == "" {
msg.ParentID = canonicalParentMsgID