Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

portal: remove reactions that fail to be pre-handled #289

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions bridgev2/portal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,14 @@ func (portal *Portal) handleMatrixReaction(ctx context.Context, sender *UserLogi
if err != nil {
log.Err(err).Msg("Failed to pre-handle Matrix reaction")
portal.sendErrorStatus(ctx, evt, err)
_, err := sender.User.DoublePuppet(ctx).SendMessage(ctx, portal.MXID, event.EventRedaction, &event.Content{
Parsed: &event.RedactionEventContent{
Redacts: evt.ID,
},
}, nil)
if err != nil {
log.Err(err).Msg("Failed to remove errored reaction")
}
return
}
existing, err := portal.Bridge.DB.Reaction.GetByID(ctx, reactionTarget.ID, reactionTarget.PartID, preResp.SenderID, preResp.EmojiID)
Expand Down Expand Up @@ -1126,6 +1134,14 @@ func (portal *Portal) handleMatrixReaction(ctx context.Context, sender *UserLogi
if err != nil {
log.Err(err).Msg("Failed to handle Matrix reaction")
portal.sendErrorStatus(ctx, evt, err)
_, err := sender.User.DoublePuppet(ctx).SendMessage(ctx, portal.MXID, event.EventRedaction, &event.Content{
Parsed: &event.RedactionEventContent{
Redacts: evt.ID,
},
}, nil)
if err != nil {
log.Err(err).Msg("Failed to remove errored reaction")
}
return
}
if dbReaction == nil {
Expand Down