mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 12:31:33 +01:00
fix: deprecate chats.leave
This commit is contained in:
@@ -108,7 +108,12 @@ chatsAPI.kick = async (caller, data) => {
|
||||
throw new Error('[[error:no-user]]');
|
||||
}
|
||||
|
||||
await messaging.removeUsersFromRoom(caller.uid, data.uids, data.roomId);
|
||||
// Additional checks if kicking vs leaving
|
||||
if (data.uids.length === 1 && parseInt(data.uids[0], 10) === caller.uid) {
|
||||
await messaging.leaveRoom([caller.uid], data.roomId);
|
||||
} else {
|
||||
await messaging.removeUsersFromRoom(caller.uid, data.uids, data.roomId);
|
||||
}
|
||||
|
||||
delete data.uids;
|
||||
return chatsAPI.users(caller, data);
|
||||
|
||||
Reference in New Issue
Block a user