From 953fcde2faec79cbef01201fd85bbcc6f586eff4 Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Wed, 4 Aug 2021 15:01:52 -0500 Subject: [PATCH] Friends: Ensure the spectator list only includes battles with your friend as a player --- server/chat-plugins/friends.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/chat-plugins/friends.ts b/server/chat-plugins/friends.ts index c7875fb745..814c6cb12f 100644 --- a/server/chat-plugins/friends.ts +++ b/server/chat-plugins/friends.ts @@ -613,8 +613,11 @@ export const pages: Chat.PageTable = { for (const friend of friends) { const curBattles: [User, string][] = [...friend.inRooms] .filter(id => { - const room = Rooms.get(id)?.battle; - return room && (!room.roomid.endsWith('pw') || friend.settings.displayBattlesToFriends); + const battle = Rooms.get(id)?.battle; + return ( + battle && battle.playerTable[friend.id] && + (!battle.roomid.endsWith('pw') || friend.settings.displayBattlesToFriends) + ); }) .map(id => [friend, id]); if (!curBattles.length) continue;