bridgev2: send notice when edit target is too old or has too many edits#501
Open
Deln0r wants to merge 1 commit into
Open
bridgev2: send notice when edit target is too old or has too many edits#501Deln0r wants to merge 1 commit into
Deln0r wants to merge 1 commit into
Conversation
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 mautrix#404 is a larger change and is left for a follow-up. Closes mautrix#404.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #404.
Problem
ErrEditTargetTooOldandErrEditTargetTooManyEditsare returned from(*Portal).handleMatrixMessagewhen 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, or a network withEditMaxCountreached). The current handler fails silently for both, leaving the user with no indication that their edit did not propagate.Fix
Add
.WithSendNotice(true)to both errors so the existing message-status notice mechanism informs the user. The matching pattern is already used by other "you tried to send something the bridge can't deliver" errors in the same file (ErrUnsupportedMessageType,ErrMediaTooLarge,ErrMediaDurationTooLong, etc.).Scope
This PR covers only the user-notification piece of #404. The optional second proposal in the issue — reverting the local Matrix edit so the chat stays consistent with the bridged version — is a larger change touching the portal redaction path and is left for a follow-up.