Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Revert behavior change for bundling edits of non-message events #14283

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions changelog.d/14283.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in Synapse 1.70.0rc1 where edits to non-message events were aggregated by the homeserver.
11 changes: 7 additions & 4 deletions synapse/storage/databases/main/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,12 @@ async def get_applicable_edits(
the event will map to None.
"""

# We only allow edits for events that have the same sender and event type.
# We can't assert these things during regular event auth so we have to do
# the checks post hoc.
# We only allow edits for `m.room.message` events that have the same sender
# and event type. We can't assert these things during regular event auth so
# we have to do the checks post hoc.

# Fetches latest edit that has the same type and sender as the original.
# Fetches latest edit that has the same type and sender as the
# original, and is an `m.room.message`.
if isinstance(self.database_engine, PostgresEngine):
# The `DISTINCT ON` clause will pick the *first* row it encounters,
# so ordering by origin server ts + event ID desc will ensure we get
Expand All @@ -504,6 +505,7 @@ async def get_applicable_edits(
WHERE
%s
AND relation_type = ?
AND edit.type = 'm.room.message'
ORDER by original.event_id DESC, edit.origin_server_ts DESC, edit.event_id DESC
"""
else:
Expand All @@ -522,6 +524,7 @@ async def get_applicable_edits(
WHERE
%s
AND relation_type = ?
AND edit.type = 'm.room.message'
ORDER by edit.origin_server_ts, edit.event_id
"""

Expand Down