mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Fix admin List Room API return type on sqlite (#13509)
This commit is contained in:
parent
b9924df264
commit
a160406d24
1
changelog.d/13509.bugfix
Normal file
1
changelog.d/13509.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix a bug introduced in Synapse 1.13 where the [List Rooms admin API](https://matrix-org.github.io/synapse/develop/admin_api/rooms.html#list-room-api) would return integers instead of booleans for the `federatable` and `public` fields when using a Sqlite database.
|
@ -641,8 +641,10 @@ class RoomWorkerStore(CacheInvalidationWorkerStore):
|
||||
"version": room[5],
|
||||
"creator": room[6],
|
||||
"encryption": room[7],
|
||||
"federatable": room[8],
|
||||
"public": room[9],
|
||||
# room_stats_state.federatable is an integer on sqlite.
|
||||
"federatable": bool(room[8]),
|
||||
# rooms.is_public is an integer on sqlite.
|
||||
"public": bool(room[9]),
|
||||
"join_rules": room[10],
|
||||
"guest_access": room[11],
|
||||
"history_visibility": room[12],
|
||||
|
@ -1080,7 +1080,9 @@ class RoomTestCase(unittest.HomeserverTestCase):
|
||||
room_ids = []
|
||||
for _ in range(total_rooms):
|
||||
room_id = self.helper.create_room_as(
|
||||
self.admin_user, tok=self.admin_user_tok
|
||||
self.admin_user,
|
||||
tok=self.admin_user_tok,
|
||||
is_public=True,
|
||||
)
|
||||
room_ids.append(room_id)
|
||||
|
||||
@ -1119,8 +1121,8 @@ class RoomTestCase(unittest.HomeserverTestCase):
|
||||
self.assertIn("version", r)
|
||||
self.assertIn("creator", r)
|
||||
self.assertIn("encryption", r)
|
||||
self.assertIn("federatable", r)
|
||||
self.assertIn("public", r)
|
||||
self.assertIs(r["federatable"], True)
|
||||
self.assertIs(r["public"], True)
|
||||
self.assertIn("join_rules", r)
|
||||
self.assertIn("guest_access", r)
|
||||
self.assertIn("history_visibility", r)
|
||||
@ -1587,8 +1589,12 @@ class RoomTestCase(unittest.HomeserverTestCase):
|
||||
def test_single_room(self) -> None:
|
||||
"""Test that a single room can be requested correctly"""
|
||||
# Create two test rooms
|
||||
room_id_1 = self.helper.create_room_as(self.admin_user, tok=self.admin_user_tok)
|
||||
room_id_2 = self.helper.create_room_as(self.admin_user, tok=self.admin_user_tok)
|
||||
room_id_1 = self.helper.create_room_as(
|
||||
self.admin_user, tok=self.admin_user_tok, is_public=True
|
||||
)
|
||||
room_id_2 = self.helper.create_room_as(
|
||||
self.admin_user, tok=self.admin_user_tok, is_public=False
|
||||
)
|
||||
|
||||
room_name_1 = "something"
|
||||
room_name_2 = "else"
|
||||
@ -1634,7 +1640,10 @@ class RoomTestCase(unittest.HomeserverTestCase):
|
||||
self.assertIn("state_events", channel.json_body)
|
||||
self.assertIn("room_type", channel.json_body)
|
||||
self.assertIn("forgotten", channel.json_body)
|
||||
|
||||
self.assertEqual(room_id_1, channel.json_body["room_id"])
|
||||
self.assertIs(True, channel.json_body["federatable"])
|
||||
self.assertIs(True, channel.json_body["public"])
|
||||
|
||||
def test_single_room_devices(self) -> None:
|
||||
"""Test that `joined_local_devices` can be requested correctly"""
|
||||
|
Loading…
Reference in New Issue
Block a user