diff options
author | Shay <hillerys@element.io> | 2024-03-19 10:55:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 17:55:31 +0000 |
commit | cf5adc80e1a362eb651abdb6d84b2397434a7f45 (patch) | |
tree | 5f75e6308ac011df789b868854ea3149309f36de | |
parent | Improve event validation (#16908) (diff) | |
download | synapse-cf5adc80e1a362eb651abdb6d84b2397434a7f45.tar.xz |
Update power level default for public rooms (#16907)
-rw-r--r-- | changelog.d/16907.misc | 1 | ||||
-rw-r--r-- | synapse/handlers/room.py | 2 | ||||
-rw-r--r-- | tests/rest/client/test_rooms.py | 18 |
3 files changed, 20 insertions, 1 deletions
diff --git a/changelog.d/16907.misc b/changelog.d/16907.misc new file mode 100644 index 0000000000..e3a7fad447 --- /dev/null +++ b/changelog.d/16907.misc @@ -0,0 +1 @@ +Update power level default for public rooms (#16907). \ No newline at end of file diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 3278426ca3..8b5ffb135e 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -151,7 +151,7 @@ class RoomCreationHandler: "history_visibility": HistoryVisibility.SHARED, "original_invitees_have_ops": False, "guest_can_join": False, - "power_level_content_override": {}, + "power_level_content_override": {EventTypes.CallInvite: 50}, }, } diff --git a/tests/rest/client/test_rooms.py b/tests/rest/client/test_rooms.py index d2f2ded487..1364615085 100644 --- a/tests/rest/client/test_rooms.py +++ b/tests/rest/client/test_rooms.py @@ -93,6 +93,7 @@ class RoomPermissionsTestCase(RoomBase): rmcreator_id = "@notme:red" def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None: + self.store_controllers = hs.get_storage_controllers() self.helper.auth_user_id = self.rmcreator_id # create some rooms under the name rmcreator_id self.uncreated_rmid = "!aa:test" @@ -482,6 +483,23 @@ class RoomPermissionsTestCase(RoomBase): expect_code=HTTPStatus.OK, ) + def test_default_call_invite_power_level(self) -> None: + pl_event = self.get_success( + self.store_controllers.state.get_current_state_event( + self.created_public_rmid, EventTypes.PowerLevels, "" + ) + ) + assert pl_event is not None + self.assertEqual(50, pl_event.content.get("m.call.invite")) + + private_pl_event = self.get_success( + self.store_controllers.state.get_current_state_event( + self.created_rmid, EventTypes.PowerLevels, "" + ) + ) + assert private_pl_event is not None + self.assertEqual(None, private_pl_event.content.get("m.call.invite")) + class RoomStateTestCase(RoomBase): """Tests /rooms/$room_id/state.""" |