From 53d482d209d9fc0630cccd12fdea198578e7b6d1 Mon Sep 17 00:00:00 2001 From: Kaitlyn Allan Date: Sat, 18 Mar 2023 18:07:39 +1000 Subject: [PATCH] Don't show channel edit button unless owner --- packages/client/src/pages/channel.vue | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/packages/client/src/pages/channel.vue b/packages/client/src/pages/channel.vue index f1eb450c82..003986ac89 100644 --- a/packages/client/src/pages/channel.vue +++ b/packages/client/src/pages/channel.vue @@ -51,13 +51,6 @@ const props = defineProps<{ let channel = $ref(null); let showBanner = $ref(true); -const pagination = { - endpoint: 'channels/timeline' as const, - limit: 10, - params: computed(() => ({ - channelId: props.channelId, - })), -}; watch(() => props.channelId, async () => { channel = await os.api('channels/show', { @@ -66,14 +59,23 @@ watch(() => props.channelId, async () => { }, { immediate: true }); function edit() { - router.push(`/channels/${channel.id}/edit`); + router.push(`/channels/${channel?.id}/edit`); } -const headerActions = $computed(() => channel && channel.userId ? [{ - icon: 'ph-gear-six ph-bold ph-lg', - text: i18n.ts.edit, - handler: edit, -}] : null); +const headerActions = $computed(() => [ + ...( + channel + && channel?.userId === $i?.id + ? [ + { + icon: 'ph-gear-six ph-bold ph-lg', + text: i18n.ts.edit, + handler: edit, + } + ] + : [] + ), +]); const headerTabs = $computed(() => []);