Skip to content

Commit

Permalink
portal: remove reactions that fail to be pre-handled
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
  • Loading branch information
sumnerevans committed Sep 25, 2024
1 parent edae083 commit 3ccf77b
Showing 1 changed file with 16 additions and 0 deletions.
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

0 comments on commit 3ccf77b

Please sign in to comment.