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

Commit b82d68c

Browse files
authored
Add the topic and avatar to the room details admin API (#8305)
1 parent 6605470 commit b82d68c

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

changelog.d/8305.feature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add the room topic and avatar to the room details admin API.

docs/admin_api/rooms.md

+4
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ The following fields are possible in the JSON response body:
275275

276276
* `room_id` - The ID of the room.
277277
* `name` - The name of the room.
278+
* `topic` - The topic of the room.
279+
* `avatar` - The `mxc` URI to the avatar of the room.
278280
* `canonical_alias` - The canonical (main) alias address of the room.
279281
* `joined_members` - How many users are currently in the room.
280282
* `joined_local_members` - How many local users are currently in the room.
@@ -304,6 +306,8 @@ Response:
304306
{
305307
"room_id": "!mscvqgqpHYjBGDxNym:matrix.org",
306308
"name": "Music Theory",
309+
"avatar": "mxc://matrix.org/AQDaVFlbkQoErdOgqWRgiGSV",
310+
"topic": "Theory, Composition, Notation, Analysis",
307311
"canonical_alias": "#musictheory:matrix.org",
308312
"joined_members": 127
309313
"joined_local_members": 2,

synapse/storage/databases/main/room.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ def get_room_with_stats_txn(txn, room_id):
104104
curr.local_users_in_room AS joined_local_members, rooms.room_version AS version,
105105
rooms.creator, state.encryption, state.is_federatable AS federatable,
106106
rooms.is_public AS public, state.join_rules, state.guest_access,
107-
state.history_visibility, curr.current_state_events AS state_events
107+
state.history_visibility, curr.current_state_events AS state_events,
108+
state.avatar, state.topic
108109
FROM rooms
109110
LEFT JOIN room_stats_state state USING (room_id)
110111
LEFT JOIN room_stats_current curr USING (room_id)

tests/rest/admin/test_room.py

+2
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,8 @@ def test_single_room(self):
11741174

11751175
self.assertIn("room_id", channel.json_body)
11761176
self.assertIn("name", channel.json_body)
1177+
self.assertIn("topic", channel.json_body)
1178+
self.assertIn("avatar", channel.json_body)
11771179
self.assertIn("canonical_alias", channel.json_body)
11781180
self.assertIn("joined_members", channel.json_body)
11791181
self.assertIn("joined_local_members", channel.json_body)

0 commit comments

Comments
 (0)