From fdead2c00ba425bb9e6e3a3e7e3ba4ab77b47a2b Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 13 Sep 2020 02:15:06 +0300 Subject: [PATCH 1/3] Add topic and avatar to room details admin API Signed-off-by: Tulir Asokan --- docs/admin_api/rooms.md | 4 ++++ synapse/storage/databases/main/room.py | 3 ++- tests/rest/admin/test_room.py | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/admin_api/rooms.md b/docs/admin_api/rooms.md index 0f267d2b7bbe..fa9b914fa7c8 100644 --- a/docs/admin_api/rooms.md +++ b/docs/admin_api/rooms.md @@ -275,6 +275,8 @@ The following fields are possible in the JSON response body: * `room_id` - The ID of the room. * `name` - The name of the room. +* `topic` - The topic of the room. +* `avatar` - The `mxc` URI to the avatar of the room. * `canonical_alias` - The canonical (main) alias address of the room. * `joined_members` - How many users are currently in the room. * `joined_local_members` - How many local users are currently in the room. @@ -304,6 +306,8 @@ Response: { "room_id": "!mscvqgqpHYjBGDxNym:matrix.org", "name": "Music Theory", + "avatar": "mxc://matrix.org/AQDaVFlbkQoErdOgqWRgiGSV", + "topic": "Theory, Composition, Notation, Analysis", "canonical_alias": "#musictheory:matrix.org", "joined_members": 127 "joined_local_members": 2, diff --git a/synapse/storage/databases/main/room.py b/synapse/storage/databases/main/room.py index 717df97301bb..127588ce4c4d 100644 --- a/synapse/storage/databases/main/room.py +++ b/synapse/storage/databases/main/room.py @@ -104,7 +104,8 @@ def get_room_with_stats_txn(txn, room_id): curr.local_users_in_room AS joined_local_members, rooms.room_version AS version, rooms.creator, state.encryption, state.is_federatable AS federatable, rooms.is_public AS public, state.join_rules, state.guest_access, - state.history_visibility, curr.current_state_events AS state_events + state.history_visibility, curr.current_state_events AS state_events, + state.avatar, state.topic FROM rooms LEFT JOIN room_stats_state state USING (room_id) LEFT JOIN room_stats_current curr USING (room_id) diff --git a/tests/rest/admin/test_room.py b/tests/rest/admin/test_room.py index 408c568a277c..6dfc709dc511 100644 --- a/tests/rest/admin/test_room.py +++ b/tests/rest/admin/test_room.py @@ -1174,6 +1174,8 @@ def test_single_room(self): self.assertIn("room_id", channel.json_body) self.assertIn("name", channel.json_body) + self.assertIn("topic", channel.json_body) + self.assertIn("avatar", channel.json_body) self.assertIn("canonical_alias", channel.json_body) self.assertIn("joined_members", channel.json_body) self.assertIn("joined_local_members", channel.json_body) From bff10850b4e03b4fab14a225ca2adeb9e2a30f8e Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 13 Sep 2020 02:20:03 +0300 Subject: [PATCH 2/3] Add changelog file Signed-off-by: Tulir Asokan --- changelog.d/8305.feature | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/8305.feature diff --git a/changelog.d/8305.feature b/changelog.d/8305.feature new file mode 100644 index 000000000000..258f76012070 --- /dev/null +++ b/changelog.d/8305.feature @@ -0,0 +1 @@ +Add topic and avatar to room details admin API. From 3cfba687228bcad57d585e0f6fe9f406316bd14a Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 14 Sep 2020 08:53:54 -0400 Subject: [PATCH 3/3] Update the changelog. --- changelog.d/8305.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/8305.feature b/changelog.d/8305.feature index 258f76012070..862dfdf95986 100644 --- a/changelog.d/8305.feature +++ b/changelog.d/8305.feature @@ -1 +1 @@ -Add topic and avatar to room details admin API. +Add the room topic and avatar to the room details admin API.