Remove links from navs if we can't see the timeline

This commit is contained in:
FloatingGhost 2023-03-15 22:20:54 +00:00
parent 6fdef479d0
commit 42ab3eada4
7 changed files with 17 additions and 6 deletions

View file

@ -322,6 +322,8 @@ const getNodeInfo = async ({ store }) => {
: federation.enabled : federation.enabled
}) })
store.dispatch('setInstanceOption', { name: 'publicTimelineVisibility', value: metadata.publicTimelineVisibility })
const accountActivationRequired = metadata.accountActivationRequired const accountActivationRequired = metadata.accountActivationRequired
store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired }) store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired })

View file

@ -19,6 +19,7 @@ import {
faInfoCircle, faInfoCircle,
faUserTie faUserTie
} from '@fortawesome/free-solid-svg-icons' } from '@fortawesome/free-solid-svg-icons'
import { mapState } from 'vuex'
library.add( library.add(
faSignInAlt, faSignInAlt,
@ -103,7 +104,10 @@ export default {
}, },
showBubbleTimeline () { showBubbleTimeline () {
return this.$store.state.instance.localBubbleInstances.length > 0 return this.$store.state.instance.localBubbleInstances.length > 0
} },
...mapState({
publicTimelineVisibility: state => state.instance.publicTimelineVisibility,
})
}, },
methods: { methods: {
scrollToTop () { scrollToTop () {

View file

@ -46,6 +46,7 @@
<router-link <router-link
:to="{ name: 'public-timeline' }" :to="{ name: 'public-timeline' }"
class="nav-icon" class="nav-icon"
v-if="(currentUser || (publicTimelineVisibility?.local ?? true))"
> >
<FAIcon <FAIcon
fixed-width fixed-width
@ -69,6 +70,7 @@
<router-link <router-link
:to="{ name: 'public-external-timeline' }" :to="{ name: 'public-external-timeline' }"
class="nav-icon" class="nav-icon"
v-if="(currentUser || (publicTimelineVisibility?.federated ?? true))"
> >
<FAIcon <FAIcon
fixed-width fixed-width

View file

@ -15,6 +15,7 @@ import {
faBookmark as faBookmarkReg, faBookmark as faBookmarkReg,
faFlag faFlag
} from '@fortawesome/free-regular-svg-icons' } from '@fortawesome/free-regular-svg-icons'
import { mapState } from 'vuex'
library.add( library.add(
faEllipsisH, faEllipsisH,
@ -191,7 +192,7 @@ const ExtraButtons = {
isEdited () { isEdited () {
return this.status.edited_at !== null return this.status.edited_at !== null
}, },
editingAvailable () { return this.$store.state.instance.editingAvailable } editingAvailable () { return this.$store.state.instance.editingAvailable },
} }
} }

View file

@ -50,7 +50,7 @@ const NavPanel = {
...mapState({ ...mapState({
currentUser: state => state.users.currentUser, currentUser: state => state.users.currentUser,
privateMode: state => state.instance.private, privateMode: state => state.instance.private,
federating: state => state.instance.federating federating: state => state.instance.federating,
}), }),
...mapGetters(['unreadAnnouncementCount']), ...mapGetters(['unreadAnnouncementCount']),
followRequestCount () { followRequestCount () {

View file

@ -24,7 +24,8 @@ const TimelineMenuContent = {
currentUser: state => state.users.currentUser, currentUser: state => state.users.currentUser,
privateMode: state => state.instance.private, privateMode: state => state.instance.private,
federating: state => state.instance.federating, federating: state => state.instance.federating,
showBubbleTimeline: state => (state.instance.localBubbleInstances.length > 0) showBubbleTimeline: state => (state.instance.localBubbleInstances.length > 0),
publicTimelineVisibility: state => state.instance.publicTimelineVisibility,
}) })
} }
} }

View file

@ -32,7 +32,7 @@
>{{ $t("nav.bubble_timeline") }}</span> >{{ $t("nav.bubble_timeline") }}</span>
</router-link> </router-link>
</li> </li>
<li v-if="currentUser || !privateMode"> <li v-if="(currentUser || !privateMode) && (publicTimelineVisibility?.local ?? true)">
<router-link <router-link
class="menu-item" class="menu-item"
:to="{ name: 'public-timeline' }" :to="{ name: 'public-timeline' }"
@ -48,7 +48,7 @@
>{{ $t("nav.public_tl") }}</span> >{{ $t("nav.public_tl") }}</span>
</router-link> </router-link>
</li> </li>
<li v-if="federating && (currentUser || !privateMode)"> <li v-if="federating && (currentUser || !privateMode) && (publicTimelineVisibility?.federated ?? true)">
<router-link <router-link
class="menu-item" class="menu-item"
:to="{ name: 'public-external-timeline' }" :to="{ name: 'public-external-timeline' }"
@ -62,6 +62,7 @@
:title="$t('nav.twkn_timeline_description')" :title="$t('nav.twkn_timeline_description')"
:aria-label="$t('nav.twkn_timeline_description')" :aria-label="$t('nav.twkn_timeline_description')"
>{{ $t("nav.twkn") }}</span> >{{ $t("nav.twkn") }}</span>
</router-link> </router-link>
</li> </li>
<li v-if="currentUser"> <li v-if="currentUser">