0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-13 16:18:56 +02:00

Apply & bundle edits for non-message events. (#15295)

This commit is contained in:
Patrick Cloke 2023-03-21 14:19:54 -04:00 committed by GitHub
parent 96bcc5d902
commit 1bc4feb6c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

1
changelog.d/15295.bugfix Normal file
View file

@ -0,0 +1 @@
Fix a long-standing bug where edits of non-`m.room.message` events would not be correctly bundled or have their new content applied.

View file

@ -472,12 +472,11 @@ class RelationsWorkerStore(SQLBaseStore):
the event will map to None.
"""
# 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.
# 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.
# Fetches latest edit that has the same type and sender as the
# original, and is an `m.room.message`.
# Fetches latest edit that has the same type and sender as the original.
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
@ -493,7 +492,6 @@ class RelationsWorkerStore(SQLBaseStore):
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:
@ -512,7 +510,6 @@ class RelationsWorkerStore(SQLBaseStore):
WHERE
%s
AND relation_type = ?
AND edit.type = 'm.room.message'
ORDER by edit.origin_server_ts, edit.event_id
"""