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

Commit 48cea25

Browse files
committed
Ensure the list media admin API is always available (#5966)
2 parents e400097 + 2f416fc commit 48cea25

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

changelog.d/5966.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix admin API for listing media in a room not being available with an external media repo.

synapse/handlers/register.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,6 @@ def _generate_user_id(self, reseed=False):
470470

471471
@defer.inlineCallbacks
472472
def _join_user_to_room(self, requester, room_identifier):
473-
room_id = None
474473
room_member_handler = self.hs.get_room_member_handler()
475474
if RoomID.is_valid(room_identifier):
476475
room_id = room_identifier
@@ -755,8 +754,7 @@ def _register_msisdn_threepid(self, user_id, threepid, bind_msisdn):
755754
Args:
756755
user_id (str): id of user
757756
threepid (object): m.login.msisdn auth response
758-
token (str): access_token for the user
759-
bind_email (bool): true if the client requested the email to be
757+
bind_msisdn (bool): true if the client requested the msisdn to be
760758
bound at the identity server
761759
Returns:
762760
defer.Deferred:

synapse/rest/admin/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
assert_user_is_admin,
4242
historical_admin_path_patterns,
4343
)
44-
from synapse.rest.admin.media import register_servlets_for_media_repo
44+
from synapse.rest.admin.media import ListMediaInRoom, register_servlets_for_media_repo
4545
from synapse.rest.admin.purge_room_servlet import PurgeRoomServlet
4646
from synapse.rest.admin.server_notice_servlet import SendServerNoticeServlet
4747
from synapse.rest.admin.users import UserAdminServlet
@@ -761,9 +761,12 @@ def register_servlets_for_client_rest_resource(hs, http_server):
761761
DeleteGroupAdminRestServlet(hs).register(http_server)
762762
AccountValidityRenewServlet(hs).register(http_server)
763763

764-
# Load the media repo ones if we're using them.
764+
# Load the media repo ones if we're using them. Otherwise load the servlets which
765+
# don't need a media repo (typically readonly admin APIs).
765766
if hs.config.can_load_media_repo:
766767
register_servlets_for_media_repo(hs, http_server)
768+
else:
769+
ListMediaInRoom(hs).register(http_server)
767770

768771
# don't add more things here: new servlets should only be exposed on
769772
# /_synapse/admin so should not go here. Instead register them in AdminRestResource.

0 commit comments

Comments
 (0)