diff --git a/gateway/gateway.go b/gateway/gateway.go index 2874ef24..89dd7ae3 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -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