1
0

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.
This commit is contained in:
Andrew Morgan
2020-03-24 13:16:51 +00:00
4 changed files with 7 additions and 14 deletions

1
changelog.d/6965.feature Normal file
View File

@@ -0,0 +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.

1
changelog.d/6970.removal Normal file
View File

@@ -0,0 +1 @@
The room list endpoint no longer returns a list of aliases.

View File

@@ -543,13 +543,13 @@ class Auth(object):
return defer.succeed(auth_ids)
@defer.inlineCallbacks
def check_can_change_room_list(self, room_id, user):
def check_can_change_room_list(self, room_id: str, user: UserID):
"""Check if the user is allowed to edit the room's entry in the
published room list.
Args:
room_id (str)
user (UserID)
room_id
user
"""
is_admin = yield self.is_server_admin(user)
@@ -561,7 +561,7 @@ class Auth(object):
# We currently require the user is a "moderator" in the room. We do this
# by checking if they would (theoretically) be able to change the
# m.room.aliases events
# m.room.canonical_alias events
power_level_event = yield self.state.get_current_state(
room_id, EventTypes.PowerLevels, ""
)
@@ -571,7 +571,7 @@ class Auth(object):
auth_events[(EventTypes.PowerLevels, "")] = power_level_event
send_level = event_auth.get_send_level(
EventTypes.Aliases, "", power_level_event
EventTypes.CanonicalAlias, "", power_level_event
)
user_level = event_auth.get_user_power_level(user_id, auth_events)

View File

@@ -216,15 +216,6 @@ class RoomListHandler(BaseHandler):
direction_is_forward=False,
).to_token()
for room in results:
# populate search result entries with additional fields, namely
# 'aliases'
room_id = room["room_id"]
aliases = yield self.store.get_aliases_for_room(room_id)
if aliases:
room["aliases"] = aliases
response["chunk"] = results
response["total_room_count_estimate"] = yield self.store.count_public_rooms(