From 0c38663ee44fa8f941b235d29aa31cf818bf13c4 Mon Sep 17 00:00:00 2001 From: Ian Chechin Date: Wed, 13 May 2026 13:56:15 +0800 Subject: [PATCH] bridgev2: send notice when edit target is too old or has too many edits ErrEditTargetTooOld and ErrEditTargetTooManyEdits are returned from the EditMaxAge / EditMaxCount checks in (*Portal).handleMatrixMessage when the user tries to edit a Matrix message that the remote network no longer accepts an edit for (e.g. WhatsApp's 15-minute edit window). The handler currently fails silently for both, leaving the user to wonder why their edit did not propagate. Add .WithSendNotice(true) so the standard message-status notice mechanism informs the user that the edit could not be bridged. The matching sibling errors that already notify the user (ErrUnsupportedMessageType, ErrMediaTooLarge, etc.) use the same construction pattern. The optional "revert the local edit" piece mentioned in #404 is a larger change and is left for a follow-up. Closes #404. --- bridgev2/errors.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bridgev2/errors.go b/bridgev2/errors.go index c7f83989..3b27921b 100644 --- a/bridgev2/errors.go +++ b/bridgev2/errors.go @@ -54,8 +54,8 @@ var ( ErrEditsNotSupportedInPortal error = WrapErrorInStatus(errors.New("edits are not allowed in this chat")).WithIsCertain(true).WithErrorAsMessage().WithErrorReason(event.MessageStatusUnsupported) ErrCaptionsNotAllowed error = WrapErrorInStatus(errors.New("captions are not supported here")).WithIsCertain(true).WithErrorAsMessage().WithErrorReason(event.MessageStatusUnsupported) ErrLocationMessagesNotAllowed error = WrapErrorInStatus(errors.New("location messages are not supported here")).WithIsCertain(true).WithErrorAsMessage().WithErrorReason(event.MessageStatusUnsupported) - ErrEditTargetTooOld error = WrapErrorInStatus(errors.New("the message is too old to be edited")).WithIsCertain(true).WithErrorAsMessage().WithErrorReason(event.MessageStatusUnsupported) - ErrEditTargetTooManyEdits error = WrapErrorInStatus(errors.New("the message has been edited too many times")).WithIsCertain(true).WithErrorAsMessage().WithErrorReason(event.MessageStatusUnsupported) + ErrEditTargetTooOld error = WrapErrorInStatus(errors.New("the message is too old to be edited")).WithIsCertain(true).WithErrorAsMessage().WithSendNotice(true).WithErrorReason(event.MessageStatusUnsupported) + ErrEditTargetTooManyEdits error = WrapErrorInStatus(errors.New("the message has been edited too many times")).WithIsCertain(true).WithErrorAsMessage().WithSendNotice(true).WithErrorReason(event.MessageStatusUnsupported) ErrReactionsNotSupported error = WrapErrorInStatus(errors.New("this bridge does not support reactions")).WithIsCertain(true).WithErrorAsMessage().WithErrorReason(event.MessageStatusUnsupported) ErrPollsNotSupported error = WrapErrorInStatus(errors.New("this bridge does not support polls")).WithIsCertain(true).WithErrorAsMessage().WithErrorReason(event.MessageStatusUnsupported) ErrUnknownPoll error = WrapErrorInStatus(errors.New("vote target poll not found")).WithIsCertain(true).WithErrorAsMessage().WithErrorReason(event.MessageStatusUnsupported)