diff --git a/changelog.d/instance-store-migration.skip b/changelog.d/instance-store-migration.skip deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/App.js b/src/App.js index 6dcd80a73..512853200 100644 --- a/src/App.js +++ b/src/App.js @@ -23,7 +23,6 @@ import { getOrCreateServiceWorker } from './services/sw/sw' import { windowHeight, windowWidth } from './services/window_utils/window_utils' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' import { useShoutStore } from 'src/stores/shout.js' @@ -147,6 +146,13 @@ export default { shout() { return useShoutStore().joined }, + showInstanceSpecificPanel() { + return ( + this.showInstanceSpecificPanel && + !this.$store.getters.mergedConfig.hideISP && + this.instanceSpecificPanelContent + ) + }, isChats() { return this.$route.name === 'chat' || this.$route.name === 'chats' }, @@ -187,28 +193,21 @@ export default { scrollParent() { return window /* this.$refs.appContentRef */ }, - showInstanceSpecificPanel() { - return ( - this.instanceSpecificPanelPresent && - !this.$store.getters.mergedConfig.hideISP - ) - }, ...mapGetters(['mergedConfig']), ...mapState(useInterfaceStore, [ 'themeApplied', 'styleDataUsed', 'layoutType', ]), - ...mapState(useInstanceStore, ['styleDataUsed']), - ...mapState(useInstanceCapabilitiesStore, [ - 'suggestionsEnabled', - 'editingAvailable', - ]), + ...mapState(useInstanceStore, ['styleDataUsed', 'private']), ...mapState(useInstanceStore, { instanceBackground: (store) => store.instanceIdentity.background, showFeaturesPanel: (store) => store.instanceIdentity.showFeaturesPanel, - instanceSpecificPanelPresent: (store) => - store.instanceIdentity.showInstanceSpecificPanel && + showInstanceSpecificPanel: (store) => + store.instanceIdentity.showInstanceSpecificPanel, + suggestionsEnabled: (store) => store.featureSet.suggestionsEnabled, + editingAvailable: (store) => store.featureSet.editingAvailable, + instanceSpecificPanelContent: (store) => store.instanceIdentity.instanceSpecificPanelContent, }), }, diff --git a/src/boot/after_store.js b/src/boot/after_store.js index b7e97cf45..79ff631ca 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -30,7 +30,6 @@ import { useAuthFlowStore } from 'src/stores/auth_flow' import { useEmojiStore } from 'src/stores/emoji.js' import { useI18nStore } from 'src/stores/i18n' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' import { useOAuthStore } from 'src/stores/oauth' @@ -83,10 +82,10 @@ const getInstanceConfig = async ({ store }) => { const textlimit = data.max_toot_chars const vapidPublicKey = data.pleroma.vapid_public_key - useInstanceCapabilitiesStore().set( - 'pleromaExtensionsAvailable', - data.pleroma, - ) + useInstanceStore().set({ + name: 'featureSet.pleromaExtensionsAvailable', + value: data.pleroma, + }) useInstanceStore().set({ name: 'textlimit', value: textlimit, @@ -279,68 +278,68 @@ const getNodeInfo = async ({ store }) => { path: 'registrationOpen', value: data.openRegistrations, }) - useInstanceCapabilitiesStore().set( - 'mediaProxyAvailable', - features.includes('media_proxy'), - ) - useInstanceCapabilitiesStore().set( - 'safeDM', - features.includes('safe_dm_mentions'), - ) - useInstanceCapabilitiesStore().set( - 'shoutAvailable', - features.includes('chat'), - ) - useInstanceCapabilitiesStore().set( - 'pleromaChatMessagesAvailable', - features.includes('pleroma_chat_messages'), - ) - useInstanceCapabilitiesStore().set( - 'pleromaCustomEmojiReactionsAvailable', - - features.includes('pleroma_custom_emoji_reactions') || + useInstanceStore().set({ + path: 'featureSet.mediaProxyAvailable', + value: features.includes('media_proxy'), + }) + useInstanceStore().set({ + path: 'featureSet.safeDM', + value: features.includes('safe_dm_mentions'), + }) + useInstanceStore().set({ + path: 'featureSet.shoutAvailable', + value: features.includes('chat'), + }) + useInstanceStore().set({ + path: 'featureSet.pleromaChatMessagesAvailable', + value: features.includes('pleroma_chat_messages'), + }) + useInstanceStore().set({ + path: 'featureSet.pleromaCustomEmojiReactionsAvailable', + value: + features.includes('pleroma_custom_emoji_reactions') || features.includes('custom_emoji_reactions'), - ) - useInstanceCapabilitiesStore().set( - 'pleromaBookmarkFoldersAvailable', - features.includes('pleroma:bookmark_folders'), - ) - useInstanceCapabilitiesStore().set( - 'gopherAvailable', - features.includes('gopher'), - ) - useInstanceCapabilitiesStore().set( - 'pollsAvailable', - features.includes('polls'), - ) - useInstanceCapabilitiesStore().set( - 'editingAvailable', - features.includes('editing'), - ) - useInstanceCapabilitiesStore().set( - 'mailerEnabled', - metadata.mailerEnabled, - ) - useInstanceCapabilitiesStore().set( - 'quotingAvailable', - features.includes('quote_posting'), - ) - useInstanceCapabilitiesStore().set( - 'groupActorAvailable', - features.includes('pleroma:group_actors'), - ) - useInstanceCapabilitiesStore().set( - 'blockExpiration', - features.includes('pleroma:block_expiration'), - ) + }) + useInstanceStore().set({ + path: 'featureSet.pleromaBookmarkFoldersAvailable', + value: features.includes('pleroma:bookmark_folders'), + }) + useInstanceStore().set({ + path: 'featureSet.gopherAvailable', + value: features.includes('gopher'), + }) + useInstanceStore().set({ + path: 'featureSet.pollsAvailable', + value: features.includes('polls'), + }) + useInstanceStore().set({ + path: 'featureSet.editingAvailable', + value: features.includes('editing'), + }) + useInstanceStore().set({ + path: 'featureSet.mailerEnabled', + value: metadata.mailerEnabled, + }) + useInstanceStore().set({ + path: 'featureSet.quotingAvailable', + value: features.includes('quote_posting'), + }) + useInstanceStore().set({ + path: 'featureSet.groupActorAvailable', + value: features.includes('pleroma:group_actors'), + }) + useInstanceStore().set({ + path: 'featureSet.blockExpiration', + value: features.includes('pleroma:block_expiration'), + }) useInstanceStore().set({ path: 'localBubbleInstances', value: metadata.localBubbleInstances ?? [], }) - useInstanceCapabilitiesStore().set( - 'localBubble', - (metadata.localBubbleInstances ?? []).length > 0, - ) + useInstanceStore().set({ + path: 'featureSet.localBubble', + value: (metadata.localBubbleInstances ?? []).length > 0, + }) useInstanceStore().set({ path: 'limits.pollLimits', @@ -348,39 +347,44 @@ const getNodeInfo = async ({ store }) => { }) const uploadLimits = metadata.uploadLimits useInstanceStore().set({ - path: 'limits.uploadlimit', + name: 'limits.uploadlimit', value: parseInt(uploadLimits.general), }) useInstanceStore().set({ - path: 'limits.avatarlimit', + name: 'limits.avatarlimit', value: parseInt(uploadLimits.avatar), }) useInstanceStore().set({ - path: 'limits.backgroundlimit', + name: 'limits.backgroundlimit', value: parseInt(uploadLimits.background), }) useInstanceStore().set({ - path: 'limits.bannerlimit', + name: 'limits.bannerlimit', value: parseInt(uploadLimits.banner), }) useInstanceStore().set({ - path: 'limits.fieldsLimits', + name: 'limits.fieldsLimits', value: metadata.fieldsLimits, }) useInstanceStore().set({ - path: 'restrictedNicknames', + name: 'restrictedNicknames', value: metadata.restrictedNicknames, }) - useInstanceCapabilitiesStore().set('postFormats', metadata.postFormats) + useInstanceStore().set({ + name: 'featureSet.postFormats', + value: metadata.postFormats, + }) const suggestions = metadata.suggestions - useInstanceCapabilitiesStore().set( - 'suggestionsEnabled', - suggestions.enabled, - ) - // this is unused, why? - useInstanceCapabilitiesStore().set('suggestionsWeb', suggestions.web) + useInstanceStore().set({ + name: 'featureSet.suggestionsEnabled', + value: suggestions.enabled, + }) + useInstanceStore().set({ + name: 'featureSet.suggestionsWeb', + value: suggestions.web, + }) const software = data.software useInstanceStore().set({ @@ -393,7 +397,7 @@ const getNodeInfo = async ({ store }) => { }) const priv = metadata.private - useInstanceStore().set({ name: 'privateMode', value: priv }) + useInstanceStore().set({ name: 'private', value: priv }) const frontendVersion = window.___pleromafe_commit_hash useInstanceStore().set({ @@ -403,26 +407,27 @@ const getNodeInfo = async ({ store }) => { const federation = metadata.federation - useInstanceCapabilitiesStore().set( - 'tagPolicyAvailable', - typeof federation.mrf_policies === 'undefined' - ? false - : metadata.federation.mrf_policies.includes('TagPolicy'), - ) + useInstanceStore().set({ + name: 'featureSet.tagPolicyAvailable', + value: + typeof federation.mrf_policies === 'undefined' + ? false + : metadata.federation.mrf_policies.includes('TagPolicy'), + }) useInstanceStore().set({ - path: 'federationPolicy', + name: 'federationPolicy', value: federation, }) useInstanceStore().set({ - path: 'federating', + name: 'federating', value: typeof federation.enabled === 'undefined' ? true : federation.enabled, }) const accountActivationRequired = metadata.accountActivationRequired useInstanceStore().set({ - path: 'accountActivationRequired', + name: 'accountActivationRequired', value: accountActivationRequired, }) diff --git a/src/boot/routes.js b/src/boot/routes.js index 193daf4a7..c5876a3d4 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -33,7 +33,6 @@ import BookmarkFolders from '../components/bookmark_folders/bookmark_folders.vue import QuotesTimeline from '../components/quotes_timeline/quotes_timeline.vue' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' export default (store) => { const validateAuthenticatedRoute = (to, from, next) => { @@ -206,7 +205,7 @@ export default (store) => { }, ] - if (useInstanceCapabilitiesStore().pleromaChatMessagesAvailable) { + if (useInstanceStore().featureSet.pleromaChatMessagesAvailable) { routes = routes.concat([ { name: 'chat', diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js index 8fce4b5af..1910d3544 100644 --- a/src/components/account_actions/account_actions.js +++ b/src/components/account_actions/account_actions.js @@ -6,7 +6,7 @@ import ConfirmModal from '../confirm_modal/confirm_modal.vue' import Popover from '../popover/popover.vue' import ProgressButton from '../progress_button/progress_button.vue' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' +import { useInstanceStore } from 'src/stores/instance.js' import { useReportsStore } from 'src/stores/reports' import { library } from '@fortawesome/fontawesome-svg-core' @@ -94,10 +94,11 @@ const AccountActions = { shouldConfirmRemoveUserFromFollowers() { return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers }, - ...mapState(useInstanceCapabilitiesStore, [ - 'blockExpiration', - 'pleromaChatMessagesAvailable', - ]), + ...mapState(useInstanceStore, { + blockExpirationSupported: (store) => store.featureSet.blockExpiration, + pleromaChatMessagesAvailable: (store) => + store.featureSet.pleromaChatMessagesAvailable, + }), }, } diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index 94cb91ee0..cc00a735d 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -95,7 +95,7 @@ store.featureSet.blockExpiration, + }), }, components: { BasicUserCard, - UserTimedFilterModal, }, methods: { unblockUser() { this.$store.dispatch('unblockUser', this.user.id) }, blockUser() { - if (this.blockExpiration) { + if (this.blockExpirationSupported) { this.$refs.timedBlockDialog.optionallyPrompt() } else { this.$store.dispatch('blockUser', { id: this.user.id }) diff --git a/src/components/desktop_nav/desktop_nav.js b/src/components/desktop_nav/desktop_nav.js index 943c66d1e..a2c48ae53 100644 --- a/src/components/desktop_nav/desktop_nav.js +++ b/src/components/desktop_nav/desktop_nav.js @@ -83,7 +83,7 @@ export default { }, ) }, - ...mapState(useInstanceStore, ['privateMode']), + ...mapState(useInstanceStore, ['private']), ...mapState(useInstanceStore, { logoMask: (store) => store.instanceIdentity.logoMask, logo: (store) => store.instanceIdentity.logo, diff --git a/src/components/desktop_nav/desktop_nav.vue b/src/components/desktop_nav/desktop_nav.vue index da427f2a1..676e2428f 100644 --- a/src/components/desktop_nav/desktop_nav.vue +++ b/src/components/desktop_nav/desktop_nav.vue @@ -33,7 +33,7 @@
diff --git a/src/components/lists_menu/lists_menu_content.js b/src/components/lists_menu/lists_menu_content.js index d96f14599..49b413b4f 100644 --- a/src/components/lists_menu/lists_menu_content.js +++ b/src/components/lists_menu/lists_menu_content.js @@ -16,6 +16,7 @@ export const ListsMenuContent = { ...mapPiniaState(useListsStore, { lists: getListEntries, }), + ...mapPiniaState(useInstanceStore, ['private','federating']), ...mapState({ currentUser: (state) => state.users.currentUser, }), diff --git a/src/components/moderation_tools/moderation_tools.js b/src/components/moderation_tools/moderation_tools.js index 4149fd6d0..6628e02f8 100644 --- a/src/components/moderation_tools/moderation_tools.js +++ b/src/components/moderation_tools/moderation_tools.js @@ -2,7 +2,6 @@ import DialogModal from '../dialog_modal/dialog_modal.vue' import Popover from '../popover/popover.vue' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faChevronDown } from '@fortawesome/free-solid-svg-icons' @@ -57,7 +56,7 @@ const ModerationTools = { }, canUseTagPolicy() { return ( - useInstanceCapabilitiesStore().tagPolicyAvailable && + useInstanceStore().featureSet.tagPolicyAvailable && this.privileged('users_manage_tags') ) }, diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index 8aff31f02..eb10c8148 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -11,7 +11,6 @@ import NavigationPins from 'src/components/navigation/navigation_pins.vue' import { useAnnouncementsStore } from 'src/stores/announcements' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useServerSideStorageStore } from 'src/stores/serverSideStorage' import { library } from '@fortawesome/fontawesome-svg-core' @@ -113,14 +112,14 @@ const NavPanel = { unreadAnnouncementCount: 'unreadAnnouncementCount', supportsAnnouncements: (store) => store.supportsAnnouncements, }), - ...mapPiniaState(useInstanceCapabilitiesStore, [ - 'pleromaChatMessagesAvailable', - 'pleromaBookmarkFoldersAvailable', - 'localBubble', - ]), ...mapPiniaState(useInstanceStore, ['federating']), ...mapPiniaState(useInstanceStore, { privateMode: (store) => store.private, + pleromaChatMessagesAvailable: (store) => + store.featureSet.pleromaChatMessagesAvailable, + bookmarkFolders: (store) => + store.featureSet.pleromaBookmarkFoldersAvailable, + bubbleTimeline: (store) => store.featureSet.localBubble, }), ...mapPiniaState(useServerSideStorageStore, { collapsed: (store) => store.prefsStorage.simple.collapseNav, @@ -143,8 +142,8 @@ const NavPanel = { isFederating: this.federating, isPrivate: this.privateMode, currentUser: this.currentUser, - supportsBubbleTimeline: this.localBubble, - supportsBookmarkFolders: this.pleromaBookmarkFoldersAvailable, + supportsBubbleTimeline: this.bubbleTimeline, + supportsBookmarkFolders: this.bookmarkFolders, }, ) }, @@ -157,8 +156,8 @@ const NavPanel = { isFederating: this.federating, isPrivate: this.privateMode, currentUser: this.currentUser, - supportsBubbleTimeline: this.localBubble, - supportsBookmarkFolders: this.pleromaBookmarkFoldersAvailable, + supportsBubbleTimeline: this.bubbleTimeline, + supportsBookmarkFolders: this.bookmarkFolders, }, ) }, diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue index ae5c6eae4..10903bcae 100644 --- a/src/components/nav_panel/nav_panel.vue +++ b/src/components/nav_panel/nav_panel.vue @@ -84,7 +84,7 @@ />
new Set(store.prefsStorage.collections.pinnedNavItems), }), - ...mapPiniaState(useInstanceStore, ['privateMode', 'federating']), - ...mapPiniaState(useInstanceCapabilitiesStore, [ - 'pleromaChatMessagesAvailable', - 'localBubble', - ]), + ...mapPiniaState(useInstanceStore, { + pleromaChatMessagesAvailable: (store) => + store.featureSet.pleromaChatMessagesAvailable, + bubbleTimeline: (store) => store.featureSet.localBubble, + }), + ...mapPiniaState(useInstanceStore, ['private', 'federating']), ...mapState({ currentUser: (state) => state.users.currentUser, followRequestCount: (state) => state.api.followRequests.length, @@ -95,13 +95,15 @@ const NavPanel = { hasChats: this.pleromaChatMessagesAvailable, hasAnnouncements: this.supportsAnnouncements, isFederating: this.federating, - isPrivate: this.privateMode, + isPrivate: this.private, currentUser: this.currentUser, - supportsBubbleTimeline: this.localBubble, + supportsBubbleTimeline: this.bubbleTimeline, supportsBookmarkFolders: this.bookmarks, }, ) } + console.log([...this.pinnedItems]) + console.log([...this.bookmarks]) return filterNavigation( [ ...Object.entries({ ...TIMELINES }) @@ -116,10 +118,10 @@ const NavPanel = { { hasChats: this.pleromaChatMessagesAvailable, hasAnnouncements: this.supportsAnnouncements, - supportsBubbleTimeline: this.localBubble, + supportsBubbleTimeline: this.bubbleTimeline, supportsBookmarkFolders: this.bookmarks, isFederating: this.federating, - isPrivate: this.privateMode, + isPrivate: this.private, currentUser: this.currentUser, }, ).slice(0, this.limit) diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 802d340ab..7b9512456 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -22,7 +22,6 @@ import StatusContent from '../status_content/status_content.vue' import { useEmojiStore } from 'src/stores/emoji.js' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' import { useMediaViewerStore } from 'src/stores/media_viewer.js' @@ -310,14 +309,14 @@ const PostStatusForm = { return this.mergedConfig.alwaysShowSubjectInput }, postFormats() { - return useInstanceCapabilitiesStore().postFormats || [] + return useInstanceStore().featureSet.postFormats || [] }, safeDMEnabled() { - return useInstanceCapabilitiesStore().safeDM + return useInstanceStore().featureSet.safeDM }, pollsAvailable() { return ( - useInstanceCapabilitiesStore().pollsAvailable && + useInstanceStore().featureSet.pollsAvailable && useInstanceStore().limits.pollLimits.max_options >= 2 && this.disablePolls !== true ) @@ -347,7 +346,7 @@ const PostStatusForm = { return typeof this.statusId !== 'undefined' && this.statusId.trim() !== '' }, quotable() { - if (!useInstanceCapabilitiesStore().quotingAvailable) { + if (!useInstanceStore().featureSet.quotingAvailable) { return false } diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js index 2884d92b4..c77de92b1 100644 --- a/src/components/settings_modal/helpers/setting.js +++ b/src/components/settings_modal/helpers/setting.js @@ -15,10 +15,6 @@ export default { type: String, default: null, }, - description: { - type: String, - default: null, - }, path: { type: [String, Array], required: false, diff --git a/src/components/settings_modal/helpers/vertical_tab_switcher.jsx b/src/components/settings_modal/helpers/vertical_tab_switcher.jsx index e407d29e5..1a8e13e18 100644 --- a/src/components/settings_modal/helpers/vertical_tab_switcher.jsx +++ b/src/components/settings_modal/helpers/vertical_tab_switcher.jsx @@ -35,6 +35,11 @@ export default { type: Boolean, default: false, }, + parentCollapsed: { + required: false, + type: Boolean, + default: null, + }, }, data() { return { @@ -197,7 +202,7 @@ export default {
diff --git a/src/components/settings_modal/settings_modal_user_content.vue b/src/components/settings_modal/settings_modal_user_content.vue index 139622781..44460adfb 100644 --- a/src/components/settings_modal/settings_modal_user_content.vue +++ b/src/components/settings_modal/settings_modal_user_content.vue @@ -3,6 +3,7 @@ ref="tabSwitcher" class="settings_tab-switcher" :scrollable-tabs="true" + :child-collapsed="childCollapsed" :body-scroll-lock="bodyLock" :hide-header="navHideHeader" > diff --git a/src/components/settings_modal/tabs/clutter_tab.js b/src/components/settings_modal/tabs/clutter_tab.js index 23e069d21..903ffe540 100644 --- a/src/components/settings_modal/tabs/clutter_tab.js +++ b/src/components/settings_modal/tabs/clutter_tab.js @@ -11,7 +11,6 @@ import SharedComputedObject from '../helpers/shared_computed_object.js' import UnitSetting from '../helpers/unit_setting.vue' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useServerSideStorageStore } from 'src/stores/serverSideStorage' const ClutterTab = { @@ -26,18 +25,14 @@ const ClutterTab = { }, computed: { ...SharedComputedObject(), - ...mapState(useInstanceCapabilitiesStore, ['shoutAvailable']), - ...mapState(useInstanceStore, { - showFeaturesPanel: (store) => store.instanceIdentity.showFeaturesPanel, - instanceSpecificPanelPresent: (store) => - store.instanceIdentity.showInstanceSpecificPanel && - store.instanceIdentity.instanceSpecificPanelContent, - }), ...mapState(useServerSideStorageStore, { muteFilters: (store) => Object.entries(store.prefsStorage.simple.muteFilters), muteFiltersObject: (store) => store.prefsStorage.simple.muteFilters, }), + ...mapState(useInstanceStore, { + blockExpirationSupported: (store) => store.featureSet.blockExpiration, + }), onMuteDefaultActionLv1: { get() { const value = this.$store.state.config.onMuteDefaultAction diff --git a/src/components/settings_modal/tabs/clutter_tab.vue b/src/components/settings_modal/tabs/clutter_tab.vue index d14d94818..daf098f5a 100644 --- a/src/components/settings_modal/tabs/clutter_tab.vue +++ b/src/components/settings_modal/tabs/clutter_tab.vue @@ -45,11 +45,6 @@ {{ $t('settings.hide_scrobbles_after') }} -
  • - - {{ $t('settings.hide_isp') }} - -
  • @@ -78,7 +73,7 @@ {{ $t('settings.user_card_hide_personal_marks') }} -
  • +
  • diff --git a/src/components/settings_modal/tabs/composing_tab.js b/src/components/settings_modal/tabs/composing_tab.js index 9d55d1f4f..ba3ddaca8 100644 --- a/src/components/settings_modal/tabs/composing_tab.js +++ b/src/components/settings_modal/tabs/composing_tab.js @@ -1,4 +1,4 @@ -import { mapState } from 'pinia' +import { mapState } from 'vuex' import FontControl from 'src/components/font_control/font_control.vue' import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue' @@ -29,6 +29,12 @@ import { library.add(faGlobe, faMessage, faPenAlt, faDatabase, faSliders) const ComposingTab = { + props: { + parentCollapsed: { + required: true, + type: Boolean, + }, + }, data() { return { subjectLineOptions: ['email', 'noop', 'masto'].map((mode) => ({ @@ -126,7 +132,9 @@ const ComposingTab = { }, }, ...SharedComputedObject(), - ...mapState(useInstanceStore, ['blockExpiration']), + ...mapState(useInstanceStore, { + blockExpirationSupported: (store) => store.featureSet.blockExpiration, + }), }, methods: { changeDefaultScope(value) { diff --git a/src/components/settings_modal/tabs/filtering_tab.js b/src/components/settings_modal/tabs/filtering_tab.js index 68efbe762..fc1d4da4c 100644 --- a/src/components/settings_modal/tabs/filtering_tab.js +++ b/src/components/settings_modal/tabs/filtering_tab.js @@ -11,7 +11,7 @@ import IntegerSetting from '../helpers/integer_setting.vue' import SharedComputedObject from '../helpers/shared_computed_object.js' import UnitSetting from '../helpers/unit_setting.vue' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' +import { useInstanceStore } from 'src/stores/instance.js' import { useInterfaceStore } from 'src/stores/interface' import { useServerSideStorageStore } from 'src/stores/serverSideStorage' @@ -97,7 +97,9 @@ const FilteringTab = { Object.entries(store.prefsStorage.simple.muteFilters), muteFiltersObject: (store) => store.prefsStorage.simple.muteFilters, }), - ...mapState(useInstanceCapabilitiesStore, ['blockExpiration']), + ...mapState(useInstanceStore, { + blockExpirationSupported: (store) => store.featureSet.blockExpiration, + }), onMuteDefaultActionLv1: { get() { const value = this.$store.state.config.onMuteDefaultAction diff --git a/src/components/settings_modal/tabs/filtering_tab.vue b/src/components/settings_modal/tabs/filtering_tab.vue index bb0dccb85..ff7498656 100644 --- a/src/components/settings_modal/tabs/filtering_tab.vue +++ b/src/components/settings_modal/tabs/filtering_tab.vue @@ -47,7 +47,7 @@
  • -
  • +
  • {{ $t('user_card.default_block_expiration') }} diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js index 0d8f9a786..3f2530278 100644 --- a/src/components/settings_modal/tabs/general_tab.js +++ b/src/components/settings_modal/tabs/general_tab.js @@ -10,11 +10,16 @@ import SharedComputedObject from '../helpers/shared_computed_object.js' import UnitSetting from '../helpers/unit_setting.vue' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import localeService from 'src/services/locale/locale.service.js' const GeneralTab = { + props: { + parentCollapsed: { + required: true, + type: Boolean, + }, + }, data() { return { absoluteTime12hOptions: ['24h', '12h'].map((mode) => ({ @@ -47,7 +52,9 @@ const GeneralTab = { }, }, ...SharedComputedObject(), - ...mapState(useInstanceCapabilitiesStore, ['blockExpiration']), + ...mapState(useInstanceStore, { + blockExpirationSupported: (store) => store.featureSet.blockExpiration, + }), }, methods: { updateProfile() { diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index c44e558b5..ceb073a48 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -157,7 +157,7 @@
  • store.featureSet.postFormats || [], + instanceSpecificPanelPresent: (store) => + store.instanceIdentity.instanceSpecificPanelPresent, + instanceShoutboxPresent: (store) => store.featureSet.shoutAvailable, + }), columns() { const mode = this.$store.getters.mergedConfig.thirdColumnMode diff --git a/src/components/settings_modal/tabs/layout_tab.vue b/src/components/settings_modal/tabs/layout_tab.vue index b52c106b9..2290b0630 100644 --- a/src/components/settings_modal/tabs/layout_tab.vue +++ b/src/components/settings_modal/tabs/layout_tab.vue @@ -69,6 +69,11 @@ {{ $t('settings.show_scrollbars') }}
  • +
  • + + {{ $t('settings.hide_isp') }} + +
  • ({ diff --git a/src/components/settings_modal/tabs/security_tab/security_tab.js b/src/components/settings_modal/tabs/security_tab/security_tab.js index 96510edcf..c24ff8b6f 100644 --- a/src/components/settings_modal/tabs/security_tab/security_tab.js +++ b/src/components/settings_modal/tabs/security_tab/security_tab.js @@ -3,7 +3,6 @@ import ProgressButton from 'src/components/progress_button/progress_button.vue' import Mfa from './mfa.vue' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useOAuthTokensStore } from 'src/stores/oauth_tokens' import localeService from 'src/services/locale/locale.service.js' @@ -46,7 +45,7 @@ const SecurityTab = { return this.$store.state.users.currentUser }, pleromaExtensionsAvailable() { - return useInstanceCapabilitiesStore().pleromaExtensionsAvailable + return useInstanceStore().featureSet.pleromaExtensionsAvailable }, oauthTokens() { return useOAuthTokensStore().tokens.map((oauthToken) => { diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js index 05d8e92f5..40fcdc23d 100644 --- a/src/components/side_drawer/side_drawer.js +++ b/src/components/side_drawer/side_drawer.js @@ -8,7 +8,6 @@ import UserCard from '../user_card/user_card.vue' import { useAnnouncementsStore } from 'src/stores/announcements' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface' import { useShoutStore } from 'src/stores/shout' @@ -96,15 +95,14 @@ const SideDrawer = { 'supportsAnnouncements', 'unreadAnnouncementCount', ]), - ...mapState(useInstanceCapabilitiesStore, [ - 'pleromaChatMessagesAvailable', - 'suggestionsEnabled', - ]), - ...mapState(useInstanceStore, ['privateMode', 'federating']), + ...mapState(useInstanceStore, ['private', 'federating']), ...mapState(useInstanceStore, { logo: (store) => store.instanceIdentity.logo, sitename: (store) => store.instanceIdentity.name, hideSitename: (store) => store.instanceIdentity.hideSitename, + pleromaChatMessagesAvailable: (store) => + store.featureSet.pleromaChatMessagesAvailable, + suggestionsEnabled: (store) => store.featureSet.suggestionsEnabled, }), ...mapGetters(['unreadChatCount', 'draftCount']), }, diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue index c034edf91..0db39d43f 100644 --- a/src/components/side_drawer/side_drawer.vue +++ b/src/components/side_drawer/side_drawer.vue @@ -47,7 +47,7 @@
    • + store.featureSet.pleromaChatMessagesAvailable, + bookmarkFolders: (store) => + store.featureSet.pleromaBookmarkFoldersAvailable, + bubbleTimeline: (store) => store.featureSet.localBubble, + }), ...mapState({ currentUser: (state) => state.users.currentUser, }), @@ -78,10 +78,10 @@ const TimelineMenu = { { hasChats: this.pleromaChatMessagesAvailable, isFederating: this.federating, - isPrivate: this.privateMode, + isPrivate: this.private, currentUser: this.currentUser, - supportsBookmarkFolders: this.pleromaBookmarkFoldersAvailable, - supportsBubbleTimeline: this.localBubble, + supportsBookmarkFolders: this.bookmarkFolders, + supportsBubbleTimeline: this.bubbleTimeline, }, ) }, diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 0df27e6cb..5cbb8b6d7 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -25,7 +25,6 @@ import UserNote from '../user_note/user_note.vue' import { useEmojiStore } from 'src/stores/emoji.js' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { usePostStatusStore } from 'src/stores/post_status' import { propsToNative } from 'src/services/attributes_helper/attributes_helper.service.js' @@ -181,7 +180,7 @@ export default { return false }, groupActorAvailable() { - return useInstanceCapabilitiesStore().groupActorAvailable + return useInstanceStore().featureSet.groupActorAvailable }, availableActorTypes() { return this.groupActorAvailable diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 25f71fba8..d40103293 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -10,7 +10,6 @@ import Timeline from '../timeline/timeline.vue' import UserCard from '../user_card/user_card.vue' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faCircleNotch } from '@fortawesome/free-solid-svg-icons' @@ -90,7 +89,7 @@ const UserProfile = { favoritesTabVisible() { return ( this.isUs || - (useInstanceCapabilitiesStore().pleromaPublicFavouritesAvailable && + (useInstanceStore().featureSet.pleromaPublicFavouritesAvailable && !this.user.hide_favorites) ) }, diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.js b/src/components/who_to_follow_panel/who_to_follow_panel.js index e364dcf80..13787000e 100644 --- a/src/components/who_to_follow_panel/who_to_follow_panel.js +++ b/src/components/who_to_follow_panel/who_to_follow_panel.js @@ -3,7 +3,6 @@ import { shuffle } from 'lodash' import apiService from '../../services/api/api.service.js' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' @@ -50,7 +49,7 @@ const WhoToFollowPanel = { return this.$store.state.users.currentUser.screen_name }, suggestionsEnabled() { - return useInstanceCapabilitiesStore().suggestionsEnabled + return useInstanceStore().featureSet.suggestionsEnabled }, }, methods: { diff --git a/src/modules/api.js b/src/modules/api.js index d6bf27f23..d658433fe 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -5,7 +5,6 @@ import backendInteractorService from '../services/backend_interactor_service/bac import { maybeShowChatNotification } from '../services/chat_utils/chat_utils.js' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' import { useShoutStore } from 'src/stores/shout.js' @@ -240,7 +239,7 @@ const api = { ) { if ( timeline === 'favourites' && - !useInstanceCapabilitiesStore().pleromaPublicFavouritesAvailable + !useInstanceStore().featureSet.pleromaPublicFavouritesAvailable ) return if (store.state.fetchers[timeline]) return @@ -325,8 +324,7 @@ const api = { // Bookmark folders startFetchingBookmarkFolders(store) { if (store.state.fetchers.bookmarkFolders) return - if (!useInstanceCapabilitiesStore().pleromaBookmarkFoldersAvailable) - return + if (!useInstanceStore().featureSet.pleromaBookmarkFoldersAvailable) return const fetcher = store.state.backendInteractor.startFetchingBookmarkFolders({ store }) store.commit('addFetcher', { fetcherName: 'bookmarkFolders', fetcher }) diff --git a/src/modules/config.js b/src/modules/config.js index 82acf8162..508ddafc6 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -59,6 +59,7 @@ const config = { }, mergedConfig(state) { const instancePrefs = useInstanceStore().prefsStorage + console.log(state) const result = Object.fromEntries( Object.keys(defaultState).map((key) => [ key, diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 339b6193a..1dcfa213b 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -15,7 +15,6 @@ import { import apiService from '../services/api/api.service.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' const emptyTl = (userId = 0) => ({ @@ -42,6 +41,7 @@ export const defaultState = () => ({ conversationsObject: {}, maxId: 0, favorites: new Set(), + pleromaScrobblesAvailable: true, // not reported in nodeinfo timelines: { mentions: emptyTl(), public: emptyTl(), @@ -115,8 +115,7 @@ const sortTimeline = (timeline) => { } const getLatestScrobble = (state, user) => { - const scrobblesSupport = - useInstanceCapabilitiesStore().pleromaScrobblesAvailable + const scrobblesSupport = state.pleromaScrobblesAvailable if (!scrobblesSupport || !user.name || user.id === 'undefined') { return @@ -135,7 +134,7 @@ const getLatestScrobble = (state, user) => { .fetchScrobbles({ accountId: user.id }) .then((scrobbles) => { if (scrobbles?.error) { - useInstanceCapabilitiesStore().set('pleromaScrobblesAvailable', false) + state.pleromaScrobblesAvailable = false return } diff --git a/src/modules/users.js b/src/modules/users.js index b0febcd3a..04c444071 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -23,7 +23,6 @@ import { import { useEmojiStore } from 'src/stores/emoji.js' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' import { useOAuthStore } from 'src/stores/oauth.js' import { useServerSideStorageStore } from 'src/stores/serverSideStorage' @@ -767,7 +766,7 @@ const users = { dispatch('startFetchingNotifications') if ( - useInstanceCapabilitiesStore().pleromaChatMessagesAvailable + useInstanceStore().featureSet.pleromaChatMessagesAvailable ) { // Start fetching chats dispatch('startFetchingChats') diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 73411b6a5..f82f98130 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -2,7 +2,6 @@ import apiService from '../api/api.service.js' import { promiseInterval } from '../promise_interval/promise_interval.js' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' const update = ({ store, notifications, older }) => { @@ -31,7 +30,7 @@ const fetchAndUpdate = ({ store, credentials, older = false, since }) => { const timelineData = rootState.notifications const hideMutedPosts = getters.mergedConfig.hideMutedPosts - if (useInstanceCapabilitiesStore().pleromaChatMessagesAvailable) { + if (useInstanceStore().featureSet.pleromaChatMessagesAvailable) { mastoApiNotificationTypes.add('pleroma:chat_mention') } diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index da62f8b37..0d993a1e3 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -4,7 +4,6 @@ import apiService from '../api/api.service.js' import { promiseInterval } from '../promise_interval/promise_interval.js' import { useInstanceStore } from 'src/stores/instance.js' -import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useInterfaceStore } from 'src/stores/interface.js' const update = ({ @@ -79,7 +78,7 @@ const fetchAndUpdate = ({ .then((response) => { if (response.errors) { if (timeline === 'favorites') { - useInstanceCapabilitiesStore().pleromaPublicFavouritesAvailable = false + useInstanceStore().featureSet.pleromaPublicFavouritesAvailable = false return } throw new Error(`${response.status} ${response.statusText}`) diff --git a/src/stores/instance.js b/src/stores/instance.js index 76ad22fb5..87bb00d12 100644 --- a/src/stores/instance.js +++ b/src/stores/instance.js @@ -20,7 +20,7 @@ const defaultState = { registrationOpen: true, server: 'http://localhost:4040/', textlimit: 5000, - privateMode: false, + private: false, federating: true, federationPolicy: null, themesIndex: null, @@ -69,6 +69,31 @@ const defaultState = { restrictedNicknames: [], localBubbleInstances: [], // Akkoma + // Feature-set, apparently, not everything here is reported... + featureSet: { + postFormats: [], + mailerEnabled: false, + safeDM: true, + shoutAvailable: false, + pleromaExtensionsAvailable: true, + pleromaChatMessagesAvailable: false, + pleromaCustomEmojiReactionsAvailable: false, + pleromaBookmarkFoldersAvailable: false, + pleromaPublicFavouritesAvailable: true, + statusNotificationTypeAvailable: true, + gopherAvailable: false, + editingAvailable: false, + mediaProxyAvailable: false, + suggestionsEnabled: false, + suggestionsWeb: '', + quotingAvailable: false, + groupActorAvailable: false, + blockExpiration: false, + tagPolicyAvailable: false, + pollsAvailable: false, + localBubble: false, // Akkoma + }, + // Version Information backendVersion: '', backendRepository: '', @@ -93,10 +118,17 @@ export const useInstanceStore = defineStore('instance', { console.error( `Unknown instance option ${path ?? name}, value: ${value}`, ) - set(this, path ?? name, value) - - if ((path ?? name) === 'name') useInterfaceStore().setPageTitle() + switch (name) { + case 'name': + useInterfaceStore().setPageTitle() + break + case 'shoutAvailable': + if (value) { + window.vuex.dispatch('initializeSocket') + } + break + } }, async getKnownDomains() { try { diff --git a/src/stores/instance_capabilities.js b/src/stores/instance_capabilities.js deleted file mode 100644 index 67c04a4ad..000000000 --- a/src/stores/instance_capabilities.js +++ /dev/null @@ -1,48 +0,0 @@ -import { defineStore } from 'pinia' - -const defaultState = { - postFormats: [], - mailerEnabled: false, - safeDM: true, - shoutAvailable: false, - pleromaExtensionsAvailable: true, - pleromaChatMessagesAvailable: false, - pleromaCustomEmojiReactionsAvailable: false, - pleromaBookmarkFoldersAvailable: false, - pleromaPublicFavouritesAvailable: true, - statusNotificationTypeAvailable: true, - gopherAvailable: false, - editingAvailable: false, - mediaProxyAvailable: false, - suggestionsEnabled: false, - suggestionsWeb: '', - quotingAvailable: false, - groupActorAvailable: false, - blockExpiration: false, - tagPolicyAvailable: false, - pollsAvailable: false, - localBubble: false, // Akkoma - scrobblesSupport: false, -} - -export const useInstanceCapabilitiesStore = defineStore( - 'instance-capabilities', - { - state: () => ({ ...defaultState }), - actions: { - set(capability, value) { - if (!Object.hasOwn(defaultState, capability)) { - console.error( - `Unknown instance capability ${capability}, value: ${value}`, - ) - } - - this[capability] = value - - if (capability === 'shoutAvailable') { - window.vuex.dispatch('initializeSocket') - } - }, - }, - }, -)