mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-26 06:49:22 -05:00
Gracefully handle failing to kick user
This commit is contained in:
parent
6b28890543
commit
72a14860ab
@ -501,12 +501,14 @@ class ShutdownRoomRestServlet(ClientV1RestServlet):
|
|||||||
|
|
||||||
users = yield self.state.get_current_user_in_room(room_id)
|
users = yield self.state.get_current_user_in_room(room_id)
|
||||||
kicked_users = []
|
kicked_users = []
|
||||||
|
failed_to_kick_users = []
|
||||||
for user_id in users:
|
for user_id in users:
|
||||||
if not self.hs.is_mine_id(user_id):
|
if not self.hs.is_mine_id(user_id):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logger.info("Kicking %r from %r...", user_id, room_id)
|
logger.info("Kicking %r from %r...", user_id, room_id)
|
||||||
|
|
||||||
|
try:
|
||||||
target_requester = create_requester(user_id)
|
target_requester = create_requester(user_id)
|
||||||
yield self.room_member_handler.update_membership(
|
yield self.room_member_handler.update_membership(
|
||||||
requester=target_requester,
|
requester=target_requester,
|
||||||
@ -529,6 +531,11 @@ class ShutdownRoomRestServlet(ClientV1RestServlet):
|
|||||||
)
|
)
|
||||||
|
|
||||||
kicked_users.append(user_id)
|
kicked_users.append(user_id)
|
||||||
|
except Exception:
|
||||||
|
logger.exception(
|
||||||
|
"Failed to leave old room and join new room for %r", user_id,
|
||||||
|
)
|
||||||
|
failed_to_kick_users.append(user_id)
|
||||||
|
|
||||||
yield self.event_creation_handler.create_and_send_nonmember_event(
|
yield self.event_creation_handler.create_and_send_nonmember_event(
|
||||||
room_creator_requester,
|
room_creator_requester,
|
||||||
@ -549,6 +556,7 @@ class ShutdownRoomRestServlet(ClientV1RestServlet):
|
|||||||
|
|
||||||
defer.returnValue((200, {
|
defer.returnValue((200, {
|
||||||
"kicked_users": kicked_users,
|
"kicked_users": kicked_users,
|
||||||
|
"failed_to_kick_users": failed_to_kick_users,
|
||||||
"local_aliases": aliases_for_room,
|
"local_aliases": aliases_for_room,
|
||||||
"new_room_id": new_room_id,
|
"new_room_id": new_room_id,
|
||||||
}))
|
}))
|
||||||
|
Loading…
Reference in New Issue
Block a user