From 872f987845bfae3909973882a8f20e3f7809ea89 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Sat, 2 Nov 2024 12:03:14 -0400 Subject: [PATCH] hide instance following / followers tabs from logged-out users --- packages/frontend/src/pages/instance-info.vue | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index bc3e93ad7d..a5e6e5ac33 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -194,6 +194,7 @@ import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js'; import { dateString } from '@/filters/date.js'; import MkTextarea from '@/components/MkTextarea.vue'; import MkInfo from '@/components/MkInfo.vue'; +import { $i } from '@/account.js'; const props = defineProps<{ host: string; @@ -422,20 +423,28 @@ const headerTabs = computed(() => [{ key: 'users', title: i18n.ts.users, icon: 'ti ti-users', -}, { - key: 'following', - title: i18n.ts.following, - icon: 'ti ti-arrow-right', -}, { - key: 'followers', - title: i18n.ts.followers, - icon: 'ti ti-arrow-left', -}, { +}, ...getFollowingTabs(), { key: 'raw', title: 'Raw', icon: 'ti ti-code', }]); +function getFollowingTabs() { + if (!$i) return []; + return [ + { + key: 'following', + title: i18n.ts.following, + icon: 'ti ti-arrow-right', + }, + { + key: 'followers', + title: i18n.ts.followers, + icon: 'ti ti-arrow-left', + }, + ]; +} + definePageMetadata(() => ({ title: props.host, icon: 'ti ti-server',