From ac04bd2b44c8de7cbedb0c1cc91ca8afea91c8ff Mon Sep 17 00:00:00 2001 From: janderedev Date: Thu, 12 Aug 2021 18:29:01 +0200 Subject: [PATCH] Filter mutual servers properly --- src/context/intermediate/popovers/UserProfile.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/context/intermediate/popovers/UserProfile.tsx b/src/context/intermediate/popovers/UserProfile.tsx index 68c071ee..bca4f9de 100644 --- a/src/context/intermediate/popovers/UserProfile.tsx +++ b/src/context/intermediate/popovers/UserProfile.tsx @@ -74,9 +74,8 @@ export const UserProfile = observer( channel.recipient_ids!.includes(user_id), ); - // Fix this once an API route for fetching mutual servers exists - const mutualServers = [...client.servers.values()].filter( - (server) => true, + const mutualServers = mutual?.servers.map((id) => + client.servers.get(id), ); useLayoutEffect(() => { @@ -428,7 +427,7 @@ export const UserProfile = observer( )} {tab === "servers" && (
- {mutualServers.length === 0 ? ( + {!mutualServers || mutualServers.length === 0 ? (