diff options
author | devonh <devon.dmytro@gmail.com> | 2023-09-15 15:25:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-15 15:25:09 +0000 |
commit | db83789654ade3cf4f900e8fbcaa742b60c5dc6c (patch) | |
tree | b68208908a4e73dba7fde6c72b91c52a47f8d018 /internal/eventutil | |
parent | 8245b24100b0afaa046bb3fe52f0994f906c8ab1 (diff) |
Move pseudoID ClientEvent hotswapping to a common location (#3199)
Fixes a variety of issues where clients were receiving pseudoIDs in
places that should be userIDs.
This change makes pseudoIDs work with sliding sync & element x.
---------
Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com>
Diffstat (limited to 'internal/eventutil')
-rw-r--r-- | internal/eventutil/events.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/eventutil/events.go b/internal/eventutil/events.go index b3523e12..40d62fd6 100644 --- a/internal/eventutil/events.go +++ b/internal/eventutil/events.go @@ -176,11 +176,13 @@ func RedactEvent(ctx context.Context, redactionEvent, redactedEvent gomatrixserv return fmt.Errorf("RedactEvent: redactionEvent isn't a redaction event, is '%s'", redactionEvent.Type()) } redactedEvent.Redact() - senderID, err := querier.QueryUserIDForSender(ctx, redactedEvent.RoomID(), redactionEvent.SenderID()) + clientEvent, err := synctypes.ToClientEvent(redactionEvent, synctypes.FormatSync, func(roomID spec.RoomID, senderID spec.SenderID) (*spec.UserID, error) { + return querier.QueryUserIDForSender(ctx, roomID, senderID) + }) if err != nil { return err } - redactedBecause := synctypes.ToClientEvent(redactionEvent, synctypes.FormatSync, senderID.String(), redactionEvent.StateKey(), redactionEvent.Unsigned()) + redactedBecause := clientEvent if err := redactedEvent.SetUnsignedField("redacted_because", redactedBecause); err != nil { return err } |