Fix third-party event modules for `check_visibility_can_be_modified` check

PR #8292 tried to maintain backwards compat with modules which don't provide a
`check_visibility_can_be_modified` method, but the tests weren't being run,
and the check didn't work.
code_spécifique_watcha
Richard van der Hoff 4 years ago
parent da11cc22be
commit 4cd1448d0e
  1. 1
      changelog.d/8467.feature
  2. 4
      synapse/events/third_party_rules.py
  3. 2
      tests/rest/client/test_third_party_rules.py

@ -0,0 +1 @@
Allow `ThirdPartyEventRules` modules to query and manipulate whether a room is in the public rooms directory.

@ -131,7 +131,9 @@ class ThirdPartyEventRules:
if self.third_party_rules is None:
return True
check_func = getattr(self.third_party_rules, "check_visibility_can_be_modified")
check_func = getattr(
self.third_party_rules, "check_visibility_can_be_modified", None
)
if not check_func or not isinstance(check_func, Callable):
return True

@ -49,7 +49,7 @@ class ThirdPartyRulesTestCase(unittest.HomeserverTestCase):
def make_homeserver(self, reactor, clock):
config = self.default_config()
config["third_party_event_rules"] = {
"module": "tests.rest.client.third_party_rules.ThirdPartyRulesTestModule",
"module": __name__ + ".ThirdPartyRulesTestModule",
"config": {},
}
Loading…
Cancel
Save