diff --git a/index.html b/index.html index fda91b0f..781b0ba3 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,6 @@ Akkoma - - diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 36b087a5..d45584c0 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -322,6 +322,9 @@ const getNodeInfo = async ({ store }) => { : federation.enabled }) + store.dispatch('setInstanceOption', { name: 'publicTimelineVisibility', value: metadata.publicTimelineVisibility }) + store.dispatch('setInstanceOption', { name: 'federatedTimelineAvailable', value: metadata.federatedTimelineAvailable }) + const accountActivationRequired = metadata.accountActivationRequired store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired }) @@ -396,9 +399,6 @@ const afterStoreSetup = async ({ store, i18n }) => { ]) // Start fetching things that don't need to block the UI - store.dispatch('fetchMutes') - store.dispatch('startFetchingAnnouncements') - store.dispatch('startFetchingReports') getTOS({ store }) getStickers({ store }) diff --git a/src/components/desktop_nav/desktop_nav.js b/src/components/desktop_nav/desktop_nav.js index f4900c38..d7538f5b 100644 --- a/src/components/desktop_nav/desktop_nav.js +++ b/src/components/desktop_nav/desktop_nav.js @@ -1,6 +1,11 @@ import SearchBar from 'components/search_bar/search_bar.vue' import ConfirmModal from '../confirm_modal/confirm_modal.vue' import { library } from '@fortawesome/fontawesome-svg-core' +import { + publicTimelineVisible, + federatedTimelineVisible, + bubbleTimelineVisible, +} from '../../lib/timeline_visibility' import { faSignInAlt, faSignOutAlt, @@ -19,6 +24,7 @@ import { faInfoCircle, faUserTie } from '@fortawesome/free-solid-svg-icons' +import { mapState } from 'vuex' library.add( faSignInAlt, @@ -103,7 +109,12 @@ export default { }, showBubbleTimeline () { return this.$store.state.instance.localBubbleInstances.length > 0 - } + }, + ...mapState({ + publicTimelineVisible, + federatedTimelineVisible, + bubbleTimelineVisible, + }) }, methods: { scrollToTop () { diff --git a/src/components/desktop_nav/desktop_nav.vue b/src/components/desktop_nav/desktop_nav.vue index 92d3fa5b..f50d1b3e 100644 --- a/src/components/desktop_nav/desktop_nav.vue +++ b/src/components/desktop_nav/desktop_nav.vue @@ -46,6 +46,7 @@ @@ -69,6 +70,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..80cf6937 100644 --- a/src/components/timeline_menu/timeline_menu_content.js +++ b/src/components/timeline_menu/timeline_menu_content.js @@ -8,6 +8,7 @@ import { faHome, faCircle } from '@fortawesome/free-solid-svg-icons' +import { federatedTimelineVisible, publicTimelineVisible, bubbleTimelineVisible } from '../../lib/timeline_visibility' library.add( faUsers, @@ -24,7 +25,9 @@ const TimelineMenuContent = { currentUser: state => state.users.currentUser, privateMode: state => state.instance.private, federating: state => state.instance.federating, - showBubbleTimeline: state => (state.instance.localBubbleInstances.length > 0) + publicTimelineVisible, + federatedTimelineVisible, + bubbleTimelineVisible, }) } } diff --git a/src/components/timeline_menu/timeline_menu_content.vue b/src/components/timeline_menu/timeline_menu_content.vue index 27aece22..bb170b82 100644 --- a/src/components/timeline_menu/timeline_menu_content.vue +++ b/src/components/timeline_menu/timeline_menu_content.vue @@ -16,7 +16,7 @@ >{{ $t("nav.home_timeline") }} -
  • +
  • {{ $t("nav.bubble_timeline") }}
  • -
  • +
  • {{ $t("nav.public_tl") }}
  • -
  • +
  • {{ $t("nav.twkn") }} +
  • diff --git a/src/components/timeline_menu_tabs/timeline_menu_content.js b/src/components/timeline_menu_tabs/timeline_menu_content.js index 9c2ef0c9..00df2120 100644 --- a/src/components/timeline_menu_tabs/timeline_menu_content.js +++ b/src/components/timeline_menu_tabs/timeline_menu_content.js @@ -8,6 +8,7 @@ import { faHome } from '@fortawesome/free-solid-svg-icons' import { faCircle } from '@fortawesome/free-regular-svg-icons' +import { federatedTimelineVisible, publicTimelineVisible, bubbleTimelineVisible } from '../../lib/timeline_visibility' library.add( faUsers, faGlobe, @@ -22,7 +23,10 @@ const TimelineMenuContent = { ...mapState({ currentUser: state => state.users.currentUser, privateMode: state => state.instance.private, - federating: state => state.instance.federating + federating: state => state.instance.federating, + publicTimelineVisible, + federatedTimelineVisible, + bubbleTimelineVisible, }) } } diff --git a/src/components/timeline_menu_tabs/timeline_menu_content.vue b/src/components/timeline_menu_tabs/timeline_menu_content.vue index 32548c49..28e58714 100644 --- a/src/components/timeline_menu_tabs/timeline_menu_content.vue +++ b/src/components/timeline_menu_tabs/timeline_menu_content.vue @@ -16,7 +16,7 @@ >{{ $t("nav.home_timeline") }}
  • -
  • +
  • {{ $t("nav.bubble_timeline") }}
  • -
  • +
  • {{ $t("nav.public_tl") }}
  • -
  • +
  • state.users.currentUser, + publicTimelineVisible, + federatedTimelineVisible, + bubbleTimelineVisible, + }) }, methods: { timelineName () { diff --git a/src/components/timeline_menu_tabs/timeline_menu_tabs.vue b/src/components/timeline_menu_tabs/timeline_menu_tabs.vue index f017fa1f..96340508 100644 --- a/src/components/timeline_menu_tabs/timeline_menu_tabs.vue +++ b/src/components/timeline_menu_tabs/timeline_menu_tabs.vue @@ -18,6 +18,7 @@ @@ -41,6 +42,7 @@ ( + state.instance.publicTimelineVisibility[timeline] ?? false +); + +const currentUser = (state) => state.users.currentUser; + +const currentUserOrTimelineVisibleUnauthenticated = (state, timeline) => ( + currentUser(state) || timelineVisibleUnauthenticated(state, timeline) +); + +const federatedTimelineAvailable = (state) => state.instance.federatedTimelineAvailable; + +export const federatedTimelineVisible = (state) => ( + federatedTimelineAvailable(state) && currentUserOrTimelineVisibleUnauthenticated(state, 'federated') +); + +export const publicTimelineVisible = (state) => ( + currentUserOrTimelineVisibleUnauthenticated(state, 'local') +); + +export const bubbleTimelineVisible = (state) => ( + state.instance.localBubbleInstances.length > 0 && currentUserOrTimelineVisibleUnauthenticated(state, 'bubble') +); diff --git a/src/modules/users.js b/src/modules/users.js index bc1943c8..209d9675 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -637,13 +637,14 @@ const users = { // Get user mutes store.dispatch('fetchMutes') - store.dispatch('setLayoutWidth', windowWidth()) store.dispatch('setLayoutHeight', windowHeight()) store.dispatch('getSupportedTranslationlanguages') store.dispatch('getSettingsProfile') store.dispatch('listSettingsProfiles') store.dispatch('startFetchingConfig') + store.dispatch('startFetchingAnnouncements') + store.dispatch('startFetchingReports') // Fetch our friends store.rootState.api.backendInteractor.fetchFriends({ id: user.id })