Filter mutual servers properly

This commit is contained in:
janderedev 2021-08-12 18:29:01 +02:00
parent 3d707a64da
commit ac04bd2b44
No known key found for this signature in database
GPG key ID: 5D5E18ACB990F57A

View file

@ -74,9 +74,8 @@ export const UserProfile = observer(
channel.recipient_ids!.includes(user_id), channel.recipient_ids!.includes(user_id),
); );
// Fix this once an API route for fetching mutual servers exists const mutualServers = mutual?.servers.map((id) =>
const mutualServers = [...client.servers.values()].filter( client.servers.get(id),
(server) => true,
); );
useLayoutEffect(() => { useLayoutEffect(() => {
@ -428,7 +427,7 @@ export const UserProfile = observer(
)} )}
{tab === "servers" && ( {tab === "servers" && (
<div className={styles.entries}> <div className={styles.entries}>
{mutualServers.length === 0 ? ( {!mutualServers || mutualServers.length === 0 ? (
<div className={styles.empty}> <div className={styles.empty}>
<Text id="app.special.popovers.user_profile.no_servers" /> <Text id="app.special.popovers.user_profile.no_servers" />
</div> </div>