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

Fix third-party event modules for check_visibility_can_be_modified check #8467

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8467.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow `ThirdPartyEventRules` modules to query and manipulate whether a room is in the public rooms directory.
4 changes: 3 additions & 1 deletion synapse/events/third_party_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ async def check_visibility_can_be_modified(
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
)
Comment on lines +134 to +136
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh this is silly, I just caught someone doing this in another PR the other day.

if not check_func or not isinstance(check_func, Callable):
return True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ThirdPartyRulesTestCase(unittest.HomeserverTestCase):
def make_homeserver(self, reactor, clock):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case it's not obvious: this file is being renamed, so that the tests actually get run.

config = self.default_config()
config["third_party_event_rules"] = {
"module": "tests.rest.client.third_party_rules.ThirdPartyRulesTestModule",
"module": __name__ + ".ThirdPartyRulesTestModule",
"config": {},
}

Expand Down