mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-14 04:45:23 -04:00
Experimental support to include bundled aggregations in search results (MSC3666) (#11837)
This commit is contained in:
parent
6c0984e3f0
commit
8c94b3abe9
5 changed files with 76 additions and 8 deletions
|
@ -453,7 +453,9 @@ class RelationsTestCase(unittest.HomeserverTestCase):
|
|||
)
|
||||
self.assertEquals(400, channel.code, channel.json_body)
|
||||
|
||||
@unittest.override_config({"experimental_features": {"msc3440_enabled": True}})
|
||||
@unittest.override_config(
|
||||
{"experimental_features": {"msc3440_enabled": True, "msc3666_enabled": True}}
|
||||
)
|
||||
def test_bundled_aggregations(self):
|
||||
"""
|
||||
Test that annotations, references, and threads get correctly bundled.
|
||||
|
@ -579,6 +581,23 @@ class RelationsTestCase(unittest.HomeserverTestCase):
|
|||
self.assertTrue(room_timeline["limited"])
|
||||
assert_bundle(self._find_event_in_chunk(room_timeline["events"]))
|
||||
|
||||
# Request search.
|
||||
channel = self.make_request(
|
||||
"POST",
|
||||
"/search",
|
||||
# Search term matches the parent message.
|
||||
content={"search_categories": {"room_events": {"search_term": "Hi"}}},
|
||||
access_token=self.user_token,
|
||||
)
|
||||
self.assertEquals(200, channel.code, channel.json_body)
|
||||
chunk = [
|
||||
result["result"]
|
||||
for result in channel.json_body["search_categories"]["room_events"][
|
||||
"results"
|
||||
]
|
||||
]
|
||||
assert_bundle(self._find_event_in_chunk(chunk))
|
||||
|
||||
def test_aggregation_get_event_for_annotation(self):
|
||||
"""Test that annotations do not get bundled aggregations included
|
||||
when directly requested.
|
||||
|
@ -759,6 +778,7 @@ class RelationsTestCase(unittest.HomeserverTestCase):
|
|||
self.assertEquals(200, channel.code, channel.json_body)
|
||||
self.assertNotIn("m.relations", channel.json_body["unsigned"])
|
||||
|
||||
@unittest.override_config({"experimental_features": {"msc3666_enabled": True}})
|
||||
def test_edit(self):
|
||||
"""Test that a simple edit works."""
|
||||
|
||||
|
@ -825,6 +845,23 @@ class RelationsTestCase(unittest.HomeserverTestCase):
|
|||
self.assertTrue(room_timeline["limited"])
|
||||
assert_bundle(self._find_event_in_chunk(room_timeline["events"]))
|
||||
|
||||
# Request search.
|
||||
channel = self.make_request(
|
||||
"POST",
|
||||
"/search",
|
||||
# Search term matches the parent message.
|
||||
content={"search_categories": {"room_events": {"search_term": "Hi"}}},
|
||||
access_token=self.user_token,
|
||||
)
|
||||
self.assertEquals(200, channel.code, channel.json_body)
|
||||
chunk = [
|
||||
result["result"]
|
||||
for result in channel.json_body["search_categories"]["room_events"][
|
||||
"results"
|
||||
]
|
||||
]
|
||||
assert_bundle(self._find_event_in_chunk(chunk))
|
||||
|
||||
def test_multi_edit(self):
|
||||
"""Test that multiple edits, including attempts by people who
|
||||
shouldn't be allowed, are correctly handled.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue