mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-03 11:36:32 -04:00
Consolidate logic for parsing relations. (#12693)
Parse the `m.relates_to` event content field (which describes relations) in a single place, this is used during: * Event persistence. * Validation of the Client-Server API. * Fetching bundled aggregations. * Processing of push rules. Each of these separately implement the logic and each made slightly different assumptions about what was valid. Some had minor / potential bugs.
This commit is contained in:
parent
cde8af9a49
commit
86a515ccbf
7 changed files with 98 additions and 61 deletions
|
@ -656,12 +656,13 @@ class UnreadMessagesTestCase(unittest.HomeserverTestCase):
|
|||
self._check_unread_count(3)
|
||||
|
||||
# Check that custom events with a body increase the unread counter.
|
||||
self.helper.send_event(
|
||||
result = self.helper.send_event(
|
||||
self.room_id,
|
||||
"org.matrix.custom_type",
|
||||
{"body": "hello"},
|
||||
tok=self.tok2,
|
||||
)
|
||||
event_id = result["event_id"]
|
||||
self._check_unread_count(4)
|
||||
|
||||
# Check that edits don't increase the unread counter.
|
||||
|
@ -671,7 +672,10 @@ class UnreadMessagesTestCase(unittest.HomeserverTestCase):
|
|||
content={
|
||||
"body": "hello",
|
||||
"msgtype": "m.text",
|
||||
"m.relates_to": {"rel_type": RelationTypes.REPLACE},
|
||||
"m.relates_to": {
|
||||
"rel_type": RelationTypes.REPLACE,
|
||||
"event_id": event_id,
|
||||
},
|
||||
},
|
||||
tok=self.tok2,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue