From 3a8354abb4d98972a6fe292d38cdb9187d08c70d Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Wed, 15 Mar 2023 22:20:54 +0000 Subject: [PATCH] Remove links from navs if we can't see the timeline --- src/boot/after_store.js | 2 ++ src/components/desktop_nav/desktop_nav.js | 6 +++++- src/components/desktop_nav/desktop_nav.vue | 2 ++ src/components/extra_buttons/extra_buttons.js | 3 ++- src/components/nav_panel/nav_panel.js | 2 +- src/components/timeline_menu/timeline_menu_content.js | 3 ++- src/components/timeline_menu/timeline_menu_content.vue | 5 +++-- 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 36b087a5..bba3e597 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -322,6 +322,8 @@ const getNodeInfo = async ({ store }) => { : federation.enabled }) + store.dispatch('setInstanceOption', { name: 'publicTimelineVisibility', value: metadata.publicTimelineVisibility }) + const accountActivationRequired = metadata.accountActivationRequired store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired }) diff --git a/src/components/desktop_nav/desktop_nav.js b/src/components/desktop_nav/desktop_nav.js index f4900c38..4cf5a477 100644 --- a/src/components/desktop_nav/desktop_nav.js +++ b/src/components/desktop_nav/desktop_nav.js @@ -19,6 +19,7 @@ import { faInfoCircle, faUserTie } from '@fortawesome/free-solid-svg-icons' +import { mapState } from 'vuex' library.add( faSignInAlt, @@ -103,7 +104,10 @@ export default { }, showBubbleTimeline () { return this.$store.state.instance.localBubbleInstances.length > 0 - } + }, + ...mapState({ + publicTimelineVisibility: state => state.instance.publicTimelineVisibility, + }) }, methods: { scrollToTop () { diff --git a/src/components/desktop_nav/desktop_nav.vue b/src/components/desktop_nav/desktop_nav.vue index 92d3fa5b..a41e9972 100644 --- a/src/components/desktop_nav/desktop_nav.vue +++ b/src/components/desktop_nav/desktop_nav.vue @@ -46,6 +46,7 @@ state.users.currentUser, privateMode: state => state.instance.private, - federating: state => state.instance.federating + federating: state => state.instance.federating, }), ...mapGetters(['unreadAnnouncementCount']), followRequestCount () { diff --git a/src/components/timeline_menu/timeline_menu_content.js b/src/components/timeline_menu/timeline_menu_content.js index df15030b..ab277d74 100644 --- a/src/components/timeline_menu/timeline_menu_content.js +++ b/src/components/timeline_menu/timeline_menu_content.js @@ -24,7 +24,8 @@ const TimelineMenuContent = { currentUser: state => state.users.currentUser, privateMode: state => state.instance.private, federating: state => state.instance.federating, - showBubbleTimeline: state => (state.instance.localBubbleInstances.length > 0) + showBubbleTimeline: state => (state.instance.localBubbleInstances.length > 0), + publicTimelineVisibility: state => state.instance.publicTimelineVisibility, }) } } diff --git a/src/components/timeline_menu/timeline_menu_content.vue b/src/components/timeline_menu/timeline_menu_content.vue index 27aece22..70af126c 100644 --- a/src/components/timeline_menu/timeline_menu_content.vue +++ b/src/components/timeline_menu/timeline_menu_content.vue @@ -32,7 +32,7 @@ >{{ $t("nav.bubble_timeline") }} -
  • +
  • {{ $t("nav.public_tl") }}
  • -
  • +
  • {{ $t("nav.twkn") }} +