From 69f23666a5fb2eaff2199b513a482750f28fd7e8 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 1 Jul 2022 11:06:54 +0300 Subject: [PATCH] Use replies for error notices --- messagetracking.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/messagetracking.go b/messagetracking.go index 1e5cfa3..8af3f43 100644 --- a/messagetracking.go +++ b/messagetracking.go @@ -94,7 +94,7 @@ func errorToStatusReason(err error) (reason event.MessageStatusReason, isCertain } } -func (portal *Portal) sendErrorMessage(err error, confirmed bool, editID id.EventID) id.EventID { +func (portal *Portal) sendErrorMessage(evt *event.Event, err error, confirmed bool, editID id.EventID) id.EventID { if !portal.bridge.Config.Bridge.MessageErrorNotices { return "" } @@ -112,6 +112,8 @@ func (portal *Portal) sendErrorMessage(err error, confirmed bool, editID id.Even } if editID != "" { content.SetEdit(editID) + } else { + content.SetReply(evt) } resp, err := portal.sendMainIntentMessage(content) if err != nil { @@ -198,7 +200,7 @@ func (portal *Portal) sendMessageMetrics(evt *event.Event, err error, part strin } portal.bridge.SendMessageCheckpoint(evt, bridge.MsgStepRemote, err, status, ms.getRetryNum()) if sendNotice { - ms.setNoticeID(portal.sendErrorMessage(err, isCertain, ms.getNoticeID())) + ms.setNoticeID(portal.sendErrorMessage(evt, err, isCertain, ms.getNoticeID())) } portal.sendStatusEvent(origEvtID, evt.ID, err) } else {