From fb6246e1f22eb3af9bbb59e01201d184c2ff07e9 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 25 Oct 2024 17:46:40 +0530 Subject: [PATCH] fix: conditional show/hide settings subscription section --- frontend/src/components/Settings/Settings.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/Settings/Settings.vue b/frontend/src/components/Settings/Settings.vue index 24a58a3ed..372609a1c 100644 --- a/frontend/src/components/Settings/Settings.vue +++ b/frontend/src/components/Settings/Settings.vue @@ -81,6 +81,7 @@ const tabs = computed(() => { }, { label: __('Subscription'), + condition: () => window.subscription_conf, items: [ { label: 'Plans', @@ -117,14 +118,15 @@ const tabs = computed(() => { }, ] - return _tabs.map((tab) => { - tab.items = tab.items.filter((item) => { - if (item.condition) { - return item.condition() - } - return true - }) - return tab + return _tabs.filter((tab) => { + if (tab.condition && !tab.condition()) return false + if (tab.items) { + tab.items = tab.items.filter((item) => { + if (item.condition && !item.condition()) return false + return true + }) + } + return true }) })