@@ -156,7 +156,7 @@ def __init__(self, hs: "HomeServer"):
156156 CHECK_VISIBILITY_CAN_BE_MODIFIED_CALLBACK
157157 ] = []
158158 self ._on_new_event_callbacks : List [ON_NEW_EVENT_CALLBACK ] = []
159- self ._check_can_delete_room : List [CHECK_CAN_SHUTDOWN_ROOM_CALLBACK ] = []
159+ self ._check_can_shutdown_room : List [CHECK_CAN_SHUTDOWN_ROOM_CALLBACK ] = []
160160 self ._check_can_deactivate_user : List [CHECK_CAN_DEACTIVATE_USER_CALLBACK ] = []
161161
162162 def register_third_party_rules_callbacks (
@@ -194,7 +194,7 @@ def register_third_party_rules_callbacks(
194194 self ._on_new_event_callbacks .append (on_new_event )
195195
196196 if check_can_shutdown_room is not None :
197- self ._check_can_delete_room .append (check_can_shutdown_room )
197+ self ._check_can_shutdown_room .append (check_can_shutdown_room )
198198
199199 if check_can_deactivate_user is not None :
200200 self ._check_can_deactivate_user .append (check_can_deactivate_user )
@@ -365,19 +365,20 @@ async def on_new_event(self, event_id: str) -> None:
365365 "Failed to run module API callback %s: %s" , callback , e
366366 )
367367
368- async def check_can_shutdown_room (self , requester : Requester , room_id : str ) -> None :
369- """Intercept requests to delete room to maybe deny it by returning False.
368+ async def check_can_shutdown_room (self , user_id : str , room_id : str ) -> bool :
369+ """Intercept requests to shutdown a room. If `False` is returned, the
370+ room should not be shut down.
370371
371372 Args:
372- requester
373+ requester: The ID of the user requesting the shutdown.
373374 room_id: The ID of the room.
374375
375376 Raises:
376377 ModuleFailureError if a callback raised any exception.
377378 """
378- for callback in self ._check_can_delete_room :
379+ for callback in self ._check_can_shutdown_room :
379380 try :
380- if await callback (requester , room_id ) is False :
381+ if await callback (user_id , room_id ) is False :
381382 return False
382383 except Exception as e :
383384 logger .exception (
@@ -387,8 +388,9 @@ async def check_can_shutdown_room(self, requester: Requester, room_id: str) -> N
387388
388389 async def check_can_deactivate_user (
389390 self , requester : Requester , user_id : str
390- ) -> None :
391- """Intercept requests to deactivate a user to maybe deny it by returning False.
391+ ) -> bool :
392+ """Intercept requests to deactivate a user. If `False` is returned, the
393+ user should not be deactivated.
392394
393395 Args:
394396 requester
0 commit comments