diff --git a/chat-commands.js b/chat-commands.js index 1c6afebe99..223c0aa158 100644 --- a/chat-commands.js +++ b/chat-commands.js @@ -751,8 +751,10 @@ exports.commands = { if (targetRoom.subRooms) { for (const subRoom of targetRoom.subRooms) subRoom.parent = null; } - if (targetRoom.parent && targetRoom.parent.subRooms) { - targetRoom.parent.subRooms.delete(targetRoom.id); + const parent = targetRoom.parent; + if (parent && parent.subRooms) { + parent.subRooms.delete(targetRoom.id); + if (!parent.subRooms.size) parent.subRooms = null; } targetRoom.add("|raw|
" + Chat.escapeHTML(user.name) + " has banned you from the room " + room.id + (room.subRooms && room.subRooms.size ? " and its subrooms" : "") + ".
" + (target ? "Reason: " + Chat.escapeHTML(target) + "
" : "") + + "|modal||html|" + Chat.escapeHTML(user.name) + " has banned you from the room " + room.id + (room.subRooms ? " and its subrooms" : "") + ".
" + (target ? "Reason: " + Chat.escapeHTML(target) + "
" : "") + "To appeal the ban, PM the staff member that banned you" + (!room.battle && room.auth ? " or a room owner.
" : ".") ); } @@ -2364,7 +2366,7 @@ exports.commands = { if (targetUser in room.users || user.can('lock')) { targetUser.popup( - "|modal||html|" + Chat.escapeHTML(user.name) + " has blacklisted you from the room " + room.id + (room.subRooms && room.subRooms.size ? " and its subrooms" : "") + ".
" + (target ? "Reason: " + Chat.escapeHTML(target) + "
" : "") + + "|modal||html|" + Chat.escapeHTML(user.name) + " has blacklisted you from the room " + room.id + (room.subRooms ? " and its subrooms" : "") + ".
" + (target ? "Reason: " + Chat.escapeHTML(target) + "
" : "") + "To appeal the ban, PM the staff member that blacklisted you" + (!room.battle && room.auth ? " or a room owner.
" : ".") ); } diff --git a/rooms.js b/rooms.js index f4720f0dee..fc226d18d5 100644 --- a/rooms.js +++ b/rooms.js @@ -706,7 +706,7 @@ class GlobalRoom extends BasicRoom { desc: room.desc, userCount: room.userCount, }; - if (room.subRooms && room.subRooms.size) roomData.subRooms = room.getSubRooms().map(room => room.title); + if (room.subRooms) roomData.subRooms = room.getSubRooms().map(room => room.title); if (room.isOfficial) { roomsData.official.push(roomData);