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

Commit 794a3d1

Browse files
committed
Stop returning aliases as part of the room list. (#6970)
* commit 'fcf459948': Stop returning aliases as part of the room list. (#6970) Publishing/removing from the directory requires a power level greater than canonical aliases.
2 parents 35d74a2 + fcf4599 commit 794a3d1

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

changelog.d/6965.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Publishing/removing a room from the room directory now requires the user to have a power level capable of modifying the canonical alias, instead of the room aliases.

changelog.d/6970.removal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The room list endpoint no longer returns a list of aliases.

synapse/api/auth.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,13 @@ def compute_auth_events(
543543
return defer.succeed(auth_ids)
544544

545545
@defer.inlineCallbacks
546-
def check_can_change_room_list(self, room_id, user):
546+
def check_can_change_room_list(self, room_id: str, user: UserID):
547547
"""Check if the user is allowed to edit the room's entry in the
548548
published room list.
549549
550550
Args:
551-
room_id (str)
552-
user (UserID)
551+
room_id
552+
user
553553
"""
554554

555555
is_admin = yield self.is_server_admin(user)
@@ -561,7 +561,7 @@ def check_can_change_room_list(self, room_id, user):
561561

562562
# We currently require the user is a "moderator" in the room. We do this
563563
# by checking if they would (theoretically) be able to change the
564-
# m.room.aliases events
564+
# m.room.canonical_alias events
565565
power_level_event = yield self.state.get_current_state(
566566
room_id, EventTypes.PowerLevels, ""
567567
)
@@ -571,7 +571,7 @@ def check_can_change_room_list(self, room_id, user):
571571
auth_events[(EventTypes.PowerLevels, "")] = power_level_event
572572

573573
send_level = event_auth.get_send_level(
574-
EventTypes.Aliases, "", power_level_event
574+
EventTypes.CanonicalAlias, "", power_level_event
575575
)
576576
user_level = event_auth.get_user_power_level(user_id, auth_events)
577577

synapse/handlers/room_list.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,6 @@ def build_room_entry(room):
216216
direction_is_forward=False,
217217
).to_token()
218218

219-
for room in results:
220-
# populate search result entries with additional fields, namely
221-
# 'aliases'
222-
room_id = room["room_id"]
223-
224-
aliases = yield self.store.get_aliases_for_room(room_id)
225-
if aliases:
226-
room["aliases"] = aliases
227-
228219
response["chunk"] = results
229220

230221
response["total_room_count_estimate"] = yield self.store.count_public_rooms(

0 commit comments

Comments
 (0)