add timeline visibility setting parsing

This commit is contained in:
FloatingGhost 2023-03-18 20:01:05 +00:00 committed by hynet-mel
parent 0f4cdcda48
commit b552d8116a
9 changed files with 17 additions and 9 deletions

View file

@ -323,6 +323,7 @@ const getNodeInfo = async ({ store }) => {
}) })
store.dispatch('setInstanceOption', { name: 'publicTimelineVisibility', value: metadata.publicTimelineVisibility }) store.dispatch('setInstanceOption', { name: 'publicTimelineVisibility', value: metadata.publicTimelineVisibility })
store.dispatch('setInstanceOption', { name: 'federatedTimelineAvailable', value: metadata.federatedTimelineAvailable })
const accountActivationRequired = metadata.accountActivationRequired const accountActivationRequired = metadata.accountActivationRequired
store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired }) store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired })

View file

@ -107,6 +107,7 @@ export default {
}, },
...mapState({ ...mapState({
publicTimelineVisibility: state => state.instance.publicTimelineVisibility, publicTimelineVisibility: state => state.instance.publicTimelineVisibility,
federatedTimelineAvailable: state => state.instance.federatedTimelineAvailable,
}) })
}, },
methods: { methods: {

View file

@ -56,7 +56,7 @@
/> />
</router-link> </router-link>
<router-link <router-link
v-if="currentUser && showBubbleTimeline" v-if="(currentUser || publicTimelineVisibility?.bubble) && showBubbleTimeline"
:to="{ name: 'bubble-timeline' }" :to="{ name: 'bubble-timeline' }"
class="nav-icon" class="nav-icon"
> >
@ -70,7 +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))" v-if="federatedTimelineAvailable && (currentUser || (publicTimelineVisibility?.federated ?? true))"
> >
<FAIcon <FAIcon
fixed-width fixed-width

View file

@ -26,6 +26,7 @@ const TimelineMenuContent = {
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, publicTimelineVisibility: state => state.instance.publicTimelineVisibility,
federatedTimelineAvailable: state => state.instance.federatedTimelineAvailable,
}) })
} }
} }

View file

@ -16,7 +16,7 @@
>{{ $t("nav.home_timeline") }}</span> >{{ $t("nav.home_timeline") }}</span>
</router-link> </router-link>
</li> </li>
<li v-if="currentUser && showBubbleTimeline"> <li v-if="(currentUser || publicTimelineVisibility?.bubble) && showBubbleTimeline">
<router-link <router-link
class="menu-item" class="menu-item"
:to="{ name: 'bubble-timeline' }" :to="{ name: 'bubble-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) && (currentUser || (publicTimelineVisibility?.federated ?? true))"> <li v-if="federating && federatedTimelineAvailable && (currentUser || !privateMode) && (currentUser || (publicTimelineVisibility?.federated ?? true))">
<router-link <router-link
class="menu-item" class="menu-item"
:to="{ name: 'public-external-timeline' }" :to="{ name: 'public-external-timeline' }"

View file

@ -22,7 +22,10 @@ const TimelineMenuContent = {
...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,
showBubbleTimeline: state => (state.instance.localBubbleInstances.length > 0),
publicTimelineVisibility: state => state.instance.publicTimelineVisibility,
federatedTimelineAvailable: state => state.instance.federatedTimelineAvailable,
}) })
} }
} }

View file

@ -16,7 +16,7 @@
>{{ $t("nav.home_timeline") }}</span> >{{ $t("nav.home_timeline") }}</span>
</router-link> </router-link>
</li> </li>
<li v-if="currentUser"> <li v-if="(currentUser || publicTimelineVisibility?.bubble) && showBubbleTimeline">
<router-link <router-link
class="menu-item" class="menu-item"
:to="{ name: 'bubble-timeline' }" :to="{ name: 'bubble-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 && federatedTimelineAvailable && (currentUser || !privateMode || publicTimelineVisibility?.federated)">
<router-link <router-link
class="menu-item" class="menu-item"
:to="{ name: 'public-external-timeline' }" :to="{ name: 'public-external-timeline' }"

View file

@ -46,6 +46,8 @@ const TimelineMenuTabs = {
...mapState({ ...mapState({
currentUser: state => state.users.currentUser, currentUser: state => state.users.currentUser,
publicTimelineVisibility: state => state.instance.publicTimelineVisibility, publicTimelineVisibility: state => state.instance.publicTimelineVisibility,
federatedTimelineAvailable: state => state.instance.federatedTimelineAvailable,
showBubbleTimeline: state => (state.instance.localBubbleInstances.length > 0),
}) })
}, },
methods: { methods: {

View file

@ -28,7 +28,7 @@
/> />
</router-link> </router-link>
<router-link <router-link
v-if="currentUser" v-if="(currentUser || publicTimelineVisibility?.bubble) && showBubbleTimeline"
:to="{ name: 'bubble-timeline' }" :to="{ name: 'bubble-timeline' }"
class="nav-icon" class="nav-icon"
> >
@ -42,7 +42,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)" v-if="(currentUser || (publicTimelineVisibility?.federated ?? true)) && federatedTimelineAvailable"
> >
<FAIcon <FAIcon
fixed-width fixed-width