From 17343be4c35638207f4a38bd15010a1e85f35c03 Mon Sep 17 00:00:00 2001 From: Patrick Connolly Date: Sat, 17 Nov 2018 04:00:27 +0800 Subject: [PATCH] Added indication of when replies are unthreaded. --- gateway/gateway.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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