From d899d06973c7c46e77f9e47f480d6967e83b4adf Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 12 Dec 2019 15:29:50 -0600 Subject: [PATCH] Use a centralized fallback for missing values and use instance.federating instead of instance.federation.enabled --- src/boot/after_store.js | 6 ++++++ src/components/nav_panel/nav_panel.js | 2 +- src/components/side_drawer/side_drawer.js | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index f169d7ba..228a0497 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -228,6 +228,12 @@ const getNodeInfo = async ({ store }) => { const federation = metadata.federation store.dispatch('setInstanceOption', { name: 'federationPolicy', value: federation }) + store.dispatch('setInstanceOption', { + name: 'federating', + value: typeof federation.enabled === 'undefined' + ? true + : federation.enabled + }) const accounts = metadata.staffAccounts await resolveStaffAccounts({ store, accounts }) diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index 515e47e6..d9268585 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -11,7 +11,7 @@ const NavPanel = { chat: state => state.chat.channel, followRequestCount: state => state.api.followRequests.length, privateMode: state => state.instance.private, - federating: state => state.instance.federationPolicy.enabled || state.instance.federationPolicy.enabled !== false + federating: state => state.instance.federating }) } diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js index 670d28b4..2534eb8f 100644 --- a/src/components/side_drawer/side_drawer.js +++ b/src/components/side_drawer/side_drawer.js @@ -46,7 +46,7 @@ const SideDrawer = { return this.$store.state.instance.private }, federating () { - return this.$store.state.instance.federationPolicy.enabled || this.$store.state.instance.federationPolicy.enabled !== false + return this.$store.state.instance.federating } }, methods: {