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

Commit

Permalink
Use the experimental configuration flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Nov 4, 2021
1 parent a1579f1 commit cd38c05
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
17 changes: 13 additions & 4 deletions synapse/api/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,19 @@ def __init__(self, hs: "HomeServer", filter_json: JsonDict):
self.labels = filter_json.get("org.matrix.labels", None)
self.not_labels = filter_json.get("org.matrix.not_labels", [])

self.relation_senders = self.filter_json.get(
"io.element.relation_senders", None
)
self.relation_types = self.filter_json.get("io.element.relation_types", None)
# Ideally these would be rejected at the endpoint if they were provided
# and not supported, but that would involve modifying the JSON schema
# based on the homeserver configuration.
if hs.config.experimental.msc3440_enabled:
self.relation_senders = self.filter_json.get(
"io.element.relation_senders", None
)
self.relation_types = self.filter_json.get(
"io.element.relation_types", None
)
else:
self.relation_senders = None
self.relation_types = None

def filters_all_types(self) -> bool:
return "*" in self.not_types
Expand Down
5 changes: 5 additions & 0 deletions tests/rest/client/test_rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2169,6 +2169,11 @@ class RelationsTestCase(unittest.HomeserverTestCase):
login.register_servlets,
]

def default_config(self):
config = super().default_config()
config["experimental_features"] = {"msc3440_enabled": True}
return config

def prepare(self, reactor, clock, homeserver):
self.user_id = self.register_user("test", "test")
self.tok = self.login("test", "test")
Expand Down
5 changes: 5 additions & 0 deletions tests/storage/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class PaginationTestCase(HomeserverTestCase):
login.register_servlets,
]

def default_config(self):
config = super().default_config()
config["experimental_features"] = {"msc3440_enabled": True}
return config

def prepare(self, reactor, clock, homeserver):
self.user_id = self.register_user("test", "test")
self.tok = self.login("test", "test")
Expand Down

0 comments on commit cd38c05

Please sign in to comment.