diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eb5a9cb4..b3d38ea24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,15 +3,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## 2.10.1 -### Fixed -- fixed being unable to set actor type from profile page -- fixed error when clicking mute menu itself (instead of submenu items) -- fixed mute -> domain status submenu not working - -### Internal -- Add playwright E2E-tests with an optional docker-based backend - ## 2.10.0 ### Changed - Temporary changes modal now shows actual countdown instead of fixed timeout diff --git a/biome.json b/biome.json index 6a464a0e5..d64639d52 100644 --- a/biome.json +++ b/biome.json @@ -132,11 +132,7 @@ "groups": [ [":NODE:", ":PACKAGE:", "!src/**", "!@fortawesome/**"], ":BLANK_LINE:", - [":PATH:", "src/components/**"], - ":BLANK_LINE:", - [":PATH:", "src/stores/**"], - ":BLANK_LINE:", - [":PATH:", "src/**", "src/stores/**", "src/components/**"], + [":PATH:", "src/**"], ":BLANK_LINE:", "@fortawesome/fontawesome-svg-core", "@fortawesome/*" diff --git a/changelog.d/actor-type.fix b/changelog.d/actor-type.fix new file mode 100644 index 000000000..a2c873c1a --- /dev/null +++ b/changelog.d/actor-type.fix @@ -0,0 +1 @@ +fixed being unable to set actor type from profile page diff --git a/changelog.d/biome.skip b/changelog.d/biome.skip new file mode 100644 index 000000000..e69de29bb diff --git a/changelog.d/e2e-tests.add b/changelog.d/e2e-tests.add new file mode 100644 index 000000000..ba62b25ac --- /dev/null +++ b/changelog.d/e2e-tests.add @@ -0,0 +1 @@ +Add playwright E2E-tests with an optional docker-based backend diff --git a/changelog.d/e2e.skip b/changelog.d/e2e.skip new file mode 100644 index 000000000..e84c25121 --- /dev/null +++ b/changelog.d/e2e.skip @@ -0,0 +1 @@ +fix e2e diff --git a/package.json b/package.json index bdd1acfbe..b00ed545a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pleroma_fe", - "version": "2.10.1", + "version": "2.10.0", "description": "Pleroma frontend, the default frontend of Pleroma social network server", "author": "Pleroma contributors ", "private": false, diff --git a/src/App.js b/src/App.js index 916b5b33a..33645c63d 100644 --- a/src/App.js +++ b/src/App.js @@ -1,5 +1,4 @@ import { throttle } from 'lodash' -import { mapState } from 'pinia' import { defineAsyncComponent } from 'vue' import { mapGetters } from 'vuex' @@ -21,10 +20,8 @@ import UserReportingModal from './components/user_reporting_modal/user_reporting import WhoToFollowPanel from './components/who_to_follow_panel/who_to_follow_panel.vue' import { getOrCreateServiceWorker } from './services/sw/sw' import { windowHeight, windowWidth } from './services/window_utils/window_utils' - -import { useInstanceStore } from 'src/stores/instance.js' -import { useInterfaceStore } from 'src/stores/interface.js' -import { useShoutStore } from 'src/stores/shout.js' +import { useInterfaceStore } from './stores/interface' +import { useShoutStore } from './stores/shout' export default { name: 'app', @@ -94,9 +91,12 @@ export default { this.scrollParent.removeEventListener('scroll', this.updateScrollState) }, computed: { + themeApplied() { + return useInterfaceStore().themeApplied + }, currentTheme() { - if (this.styleDataUsed) { - const styleMeta = this.styleDataUsed.find( + if (useInterfaceStore().styleDataUsed) { + const styleMeta = useInterfaceStore().styleDataUsed.find( (x) => x.component === '@meta', ) @@ -134,7 +134,9 @@ export default { return this.currentUser.background_image }, instanceBackground() { - return this.mergedConfig.hideInstanceWallpaper ? null : this.background + return this.mergedConfig.hideInstanceWallpaper + ? null + : this.$store.state.instance.background }, background() { return this.userBackground || this.instanceBackground @@ -149,11 +151,14 @@ export default { shout() { return useShoutStore().joined }, + suggestionsEnabled() { + return this.$store.state.instance.suggestionsEnabled + }, showInstanceSpecificPanel() { return ( - this.showInstanceSpecificPanel && + this.$store.state.instance.showInstanceSpecificPanel && !this.$store.getters.mergedConfig.hideISP && - this.instanceSpecificPanelContent + this.$store.state.instance.instanceSpecificPanelContent ) }, isChats() { @@ -170,12 +175,24 @@ export default { this.layoutType === 'mobile' ) }, + showFeaturesPanel() { + return this.$store.state.instance.showFeaturesPanel + }, + editingAvailable() { + return this.$store.state.instance.editingAvailable + }, shoutboxPosition() { return this.$store.getters.mergedConfig.alwaysShowNewPostButton || false }, hideShoutbox() { return this.$store.getters.mergedConfig.hideShoutbox }, + layoutType() { + return useInterfaceStore().layoutType + }, + privateMode() { + return this.$store.state.instance.private + }, reverseLayout() { const { thirdColumnMode, sidebarRight: reverseSetting } = this.$store.getters.mergedConfig @@ -197,22 +214,6 @@ export default { return window /* this.$refs.appContentRef */ }, ...mapGetters(['mergedConfig']), - ...mapState(useInterfaceStore, [ - 'themeApplied', - 'styleDataUsed', - 'layoutType', - ]), - ...mapState(useInstanceStore, ['styleDataUsed', 'private']), - ...mapState(useInstanceStore, { - background: (store) => store.instanceIdentity.background, - showFeaturesPanel: (store) => store.instanceIdentity.showFeaturesPanel, - showInstanceSpecificPanel: (store) => - store.instanceIdentity.showInstanceSpecificPanel, - suggestionsEnabled: (store) => store.featureSet.suggestionsEnabled, - editingAvailable: (store) => store.featureSet.editingAvailable, - instanceSpecificPanelContent: (store) => - store.instanceIdentity.instanceSpecificPanelContent, - }), }, methods: { resizeHandler() { diff --git a/src/boot/after_store.js b/src/boot/after_store.js index a970d25cc..1a2be5bd7 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -14,6 +14,16 @@ import { config.autoAddCss = false +import VBodyScrollLock from 'src/directives/body_scroll_lock' +import { + instanceDefaultConfig, + staticOrApiConfigDefault, +} from 'src/modules/default_config_state.js' +import { useAnnouncementsStore } from 'src/stores/announcements' +import { useAuthFlowStore } from 'src/stores/auth_flow' +import { useI18nStore } from 'src/stores/i18n' +import { useInterfaceStore } from 'src/stores/interface' +import { useOAuthStore } from 'src/stores/oauth' import App from '../App.vue' import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js' import FaviconService from '../services/favicon_service/favicon_service.js' @@ -25,20 +35,6 @@ import { } from '../services/window_utils/window_utils' import routes from './routes' -import { useAnnouncementsStore } from 'src/stores/announcements' -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 { useInterfaceStore } from 'src/stores/interface.js' -import { useOAuthStore } from 'src/stores/oauth' - -import VBodyScrollLock from 'src/directives/body_scroll_lock' -import { - instanceDefaultConfig, - staticOrApiConfigDefault, -} from 'src/modules/default_config_state.js' - let staticInitialResults = null const parsedInitialResults = () => { @@ -82,29 +78,29 @@ const getInstanceConfig = async ({ store }) => { const textlimit = data.max_toot_chars const vapidPublicKey = data.pleroma.vapid_public_key - useInstanceStore().set({ - name: 'featureSet.pleromaExtensionsAvailable', + store.dispatch('setInstanceOption', { + name: 'pleromaExtensionsAvailable', value: data.pleroma, }) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'textlimit', value: textlimit, }) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'accountApprovalRequired', value: data.approval_required, }) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'birthdayRequired', value: !!data.pleroma?.metadata.birthday_required, }) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'birthdayMinAge', value: data.pleroma?.metadata.birthday_min_age || 0, }) if (vapidPublicKey) { - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'vapidPublicKey', value: vapidPublicKey, }) @@ -165,18 +161,14 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => { config = Object.assign({}, staticConfig, apiConfig) } - const copyInstanceOption = ({ source, destination }) => { - if (typeof config[source] !== 'undefined') { - useInstanceStore().set({ path: destination, value: config[source] }) + const copyInstanceOption = (name) => { + if (typeof config[name] !== 'undefined') { + store.dispatch('setInstanceOption', { name, value: config[name] }) } } - Object.keys(staticOrApiConfigDefault) - .map((k) => ({ source: k, destination: `instanceIdentity.${k}` })) - .forEach(copyInstanceOption) - Object.keys(instanceDefaultConfig) - .map((k) => ({ source: k, destination: `prefsStorage.${k}` })) - .forEach(copyInstanceOption) + Object.keys(staticOrApiConfigDefault).forEach(copyInstanceOption) + Object.keys(instanceDefaultConfig).forEach(copyInstanceOption) useAuthFlowStore().setInitialStrategy(config.loginMethod) } @@ -186,7 +178,7 @@ const getTOS = async ({ store }) => { const res = await window.fetch('/static/terms-of-service.html') if (res.ok) { const html = await res.text() - useInstanceStore().set({ name: 'instanceIdentity.tos', value: html }) + store.dispatch('setInstanceOption', { name: 'tos', value: html }) } else { throw res } @@ -200,8 +192,8 @@ const getInstancePanel = async ({ store }) => { const res = await preloadFetch('/instance/panel.html') if (res.ok) { const html = await res.text() - useInstanceStore().set({ - name: 'instanceIdentity.instanceSpecificPanelContent', + store.dispatch('setInstanceOption', { + name: 'instanceSpecificPanelContent', value: html, }) } else { @@ -235,7 +227,7 @@ const getStickers = async ({ store }) => { ).sort((a, b) => { return a.meta.title.localeCompare(b.meta.title) }) - useEmojiStore().setStickers(stickers) + store.dispatch('setInstanceOption', { name: 'stickers', value: stickers }) } else { throw res } @@ -256,7 +248,7 @@ const getAppSecret = async ({ store }) => { const resolveStaffAccounts = ({ store, accounts }) => { const nicknames = accounts.map((uri) => uri.split('/').pop()) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'staffAccounts', value: nicknames, }) @@ -270,163 +262,159 @@ const getNodeInfo = async ({ store }) => { const data = await res.json() const metadata = data.metadata const features = metadata.features - useInstanceStore().set({ - path: 'name', + store.dispatch('setInstanceOption', { + name: 'name', value: metadata.nodeName, }) - useInstanceStore().set({ - path: 'registrationOpen', + store.dispatch('setInstanceOption', { + name: 'registrationOpen', value: data.openRegistrations, }) - useInstanceStore().set({ - path: 'featureSet.mediaProxyAvailable', + store.dispatch('setInstanceOption', { + name: 'mediaProxyAvailable', value: features.includes('media_proxy'), }) - useInstanceStore().set({ - path: 'featureSet.safeDM', + store.dispatch('setInstanceOption', { + name: 'safeDM', value: features.includes('safe_dm_mentions'), }) - useInstanceStore().set({ - path: 'featureSet.shoutAvailable', + store.dispatch('setInstanceOption', { + name: 'shoutAvailable', value: features.includes('chat'), }) - useInstanceStore().set({ - path: 'featureSet.pleromaChatMessagesAvailable', + store.dispatch('setInstanceOption', { + name: 'pleromaChatMessagesAvailable', value: features.includes('pleroma_chat_messages'), }) - useInstanceStore().set({ - path: 'featureSet.pleromaCustomEmojiReactionsAvailable', + store.dispatch('setInstanceOption', { + name: 'pleromaCustomEmojiReactionsAvailable', value: features.includes('pleroma_custom_emoji_reactions') || features.includes('custom_emoji_reactions'), }) - useInstanceStore().set({ - path: 'featureSet.pleromaBookmarkFoldersAvailable', + store.dispatch('setInstanceOption', { + name: 'pleromaBookmarkFoldersAvailable', value: features.includes('pleroma:bookmark_folders'), }) - useInstanceStore().set({ - path: 'featureSet.gopherAvailable', + store.dispatch('setInstanceOption', { + name: 'gopherAvailable', value: features.includes('gopher'), }) - useInstanceStore().set({ - path: 'featureSet.pollsAvailable', + store.dispatch('setInstanceOption', { + name: 'pollsAvailable', value: features.includes('polls'), }) - useInstanceStore().set({ - path: 'featureSet.editingAvailable', + store.dispatch('setInstanceOption', { + name: '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 ?? [], - }) - useInstanceStore().set({ - path: 'featureSet.localBubble', - value: (metadata.localBubbleInstances ?? []).length > 0, - }) - - useInstanceStore().set({ - path: 'limits.pollLimits', + store.dispatch('setInstanceOption', { + name: 'pollLimits', value: metadata.pollLimits, }) + store.dispatch('setInstanceOption', { + name: 'mailerEnabled', + value: metadata.mailerEnabled, + }) + store.dispatch('setInstanceOption', { + name: 'quotingAvailable', + value: features.includes('quote_posting'), + }) + store.dispatch('setInstanceOption', { + name: 'groupActorAvailable', + value: features.includes('pleroma:group_actors'), + }) + store.dispatch('setInstanceOption', { + name: 'blockExpiration', + value: features.includes('pleroma:block_expiration'), + }) + store.dispatch('setInstanceOption', { + name: 'localBubbleInstances', + value: metadata.localBubbleInstances ?? [], + }) + const uploadLimits = metadata.uploadLimits - useInstanceStore().set({ - name: 'limits.uploadlimit', + store.dispatch('setInstanceOption', { + name: 'uploadlimit', value: parseInt(uploadLimits.general), }) - useInstanceStore().set({ - name: 'limits.avatarlimit', + store.dispatch('setInstanceOption', { + name: 'avatarlimit', value: parseInt(uploadLimits.avatar), }) - useInstanceStore().set({ - name: 'limits.backgroundlimit', + store.dispatch('setInstanceOption', { + name: 'backgroundlimit', value: parseInt(uploadLimits.background), }) - useInstanceStore().set({ - name: 'limits.bannerlimit', + store.dispatch('setInstanceOption', { + name: 'bannerlimit', value: parseInt(uploadLimits.banner), }) - useInstanceStore().set({ - name: 'limits.fieldsLimits', + store.dispatch('setInstanceOption', { + name: 'fieldsLimits', value: metadata.fieldsLimits, }) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'restrictedNicknames', value: metadata.restrictedNicknames, }) - useInstanceStore().set({ - name: 'featureSet.postFormats', + store.dispatch('setInstanceOption', { + name: 'postFormats', value: metadata.postFormats, }) const suggestions = metadata.suggestions - useInstanceStore().set({ - name: 'featureSet.suggestionsEnabled', + store.dispatch('setInstanceOption', { + name: 'suggestionsEnabled', value: suggestions.enabled, }) - useInstanceStore().set({ - name: 'featureSet.suggestionsWeb', + store.dispatch('setInstanceOption', { + name: 'suggestionsWeb', value: suggestions.web, }) const software = data.software - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'backendVersion', value: software.version, }) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'backendRepository', value: software.repository, }) const priv = metadata.private - useInstanceStore().set({ name: 'private', value: priv }) + store.dispatch('setInstanceOption', { name: 'private', value: priv }) const frontendVersion = window.___pleromafe_commit_hash - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'frontendVersion', value: frontendVersion, }) const federation = metadata.federation - useInstanceStore().set({ - name: 'featureSet.tagPolicyAvailable', + store.dispatch('setInstanceOption', { + name: 'tagPolicyAvailable', value: typeof federation.mrf_policies === 'undefined' ? false : metadata.federation.mrf_policies.includes('TagPolicy'), }) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'federationPolicy', value: federation, }) - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'federating', value: typeof federation.enabled === 'undefined' ? true : federation.enabled, }) const accountActivationRequired = metadata.accountActivationRequired - useInstanceStore().set({ + store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired, }) @@ -538,7 +526,7 @@ const afterStoreSetup = async ({ pinia, store, storageError, i18n }) => { typeof overrides.target !== 'undefined' ? overrides.target : window.location.origin - useInstanceStore().set({ name: 'server', value: server }) + store.dispatch('setInstanceOption', { name: 'server', value: server }) await setConfig({ store }) try { diff --git a/src/boot/routes.js b/src/boot/routes.js index c5876a3d4..3296755a1 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -32,16 +32,12 @@ import BookmarkFolderEdit from '../components/bookmark_folder_edit/bookmark_fold 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' - export default (store) => { const validateAuthenticatedRoute = (to, from, next) => { if (store.state.users.currentUser) { next() } else { - next( - useInstanceStore().instanceIdentity.redirectRootNoLogin || '/main/all', - ) + next(store.state.instance.redirectRootNoLogin || '/main/all') } } @@ -52,9 +48,8 @@ export default (store) => { redirect: () => { return ( (store.state.users.currentUser - ? useInstanceStore().instanceIdentity.redirectRootLogin - : useInstanceStore().instanceIdentity.redirectRootNoLogin) || - '/main/all' + ? store.state.instance.redirectRootLogin + : store.state.instance.redirectRootNoLogin) || '/main/all' ) }, }, @@ -205,7 +200,7 @@ export default (store) => { }, ] - if (useInstanceStore().featureSet.pleromaChatMessagesAvailable) { + if (store.state.instance.pleromaChatMessagesAvailable) { routes = routes.concat([ { name: 'chat', diff --git a/src/components/about/about.js b/src/components/about/about.js index f52d5c797..d091dfd0a 100644 --- a/src/components/about/about.js +++ b/src/components/about/about.js @@ -4,8 +4,6 @@ import MRFTransparencyPanel from '../mrf_transparency_panel/mrf_transparency_pan import StaffPanel from '../staff_panel/staff_panel.vue' import TermsOfServicePanel from '../terms_of_service_panel/terms_of_service_panel.vue' -import { useInstanceStore } from 'src/stores/instance.js' - const About = { components: { InstanceSpecificPanel, @@ -16,13 +14,13 @@ const About = { }, computed: { showFeaturesPanel() { - return useInstanceStore().instanceIdentity.showFeaturesPanel + return this.$store.state.instance.showFeaturesPanel }, showInstanceSpecificPanel() { return ( - useInstanceStore().instanceIdentity.showInstanceSpecificPanel && + this.$store.state.instance.showInstanceSpecificPanel && !this.$store.getters.mergedConfig.hideISP && - useInstanceStore().instanceIdentity.instanceSpecificPanelContent + this.$store.state.instance.instanceSpecificPanelContent ) }, }, diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js index 1910d3544..ee94dc544 100644 --- a/src/components/account_actions/account_actions.js +++ b/src/components/account_actions/account_actions.js @@ -1,14 +1,12 @@ -import { mapState } from 'pinia' +import { mapState } from 'vuex' import UserListMenu from 'src/components/user_list_menu/user_list_menu.vue' import UserTimedFilterModal from 'src/components/user_timed_filter_modal/user_timed_filter_modal.vue' +import { useReportsStore } from 'src/stores/reports' import ConfirmModal from '../confirm_modal/confirm_modal.vue' import Popover from '../popover/popover.vue' import ProgressButton from '../progress_button/progress_button.vue' -import { useInstanceStore } from 'src/stores/instance.js' -import { useReportsStore } from 'src/stores/reports' - import { library } from '@fortawesome/fontawesome-svg-core' import { faEllipsisV } from '@fortawesome/free-solid-svg-icons' @@ -94,10 +92,10 @@ const AccountActions = { shouldConfirmRemoveUserFromFollowers() { return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers }, - ...mapState(useInstanceStore, { - blockExpirationSupported: (store) => store.featureSet.blockExpiration, - pleromaChatMessagesAvailable: (store) => - store.featureSet.pleromaChatMessagesAvailable, + ...mapState({ + blockExpirationSupported: (state) => state.instance.blockExpiration, + pleromaChatMessagesAvailable: (state) => + state.instance.pleromaChatMessagesAvailable, }), }, } diff --git a/src/components/announcement/announcement.js b/src/components/announcement/announcement.js index 13d55c159..906b84ce2 100644 --- a/src/components/announcement/announcement.js +++ b/src/components/announcement/announcement.js @@ -1,11 +1,10 @@ import { mapState } from 'vuex' +import { useAnnouncementsStore } from 'src/stores/announcements' import localeService from '../../services/locale/locale.service.js' import AnnouncementEditor from '../announcement_editor/announcement_editor.vue' import RichContent from '../rich_content/rich_content.jsx' -import { useAnnouncementsStore } from 'src/stores/announcements.js' - const Announcement = { components: { AnnouncementEditor, diff --git a/src/components/announcements_page/announcements_page.js b/src/components/announcements_page/announcements_page.js index b8b1f000a..0c4383d2e 100644 --- a/src/components/announcements_page/announcements_page.js +++ b/src/components/announcements_page/announcements_page.js @@ -1,10 +1,9 @@ import { mapState } from 'vuex' +import { useAnnouncementsStore } from 'src/stores/announcements' import Announcement from '../announcement/announcement.vue' import AnnouncementEditor from '../announcement_editor/announcement_editor.vue' -import { useAnnouncementsStore } from 'src/stores/announcements.js' - const AnnouncementsPage = { components: { Announcement, diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index d1884ba5c..31fceba60 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -1,14 +1,12 @@ import { mapGetters } from 'vuex' +import { useMediaViewerStore } from 'src/stores/media_viewer' import nsfwImage from '../../assets/nsfw.png' import fileTypeService from '../../services/file_type/file_type.service.js' import Flash from '../flash/flash.vue' import StillImage from '../still-image/still-image.vue' import VideoAttachment from '../video_attachment/video_attachment.vue' -import { useInstanceStore } from 'src/stores/instance.js' -import { useMediaViewerStore } from 'src/stores/media_viewer' - import { library } from '@fortawesome/fontawesome-svg-core' import { faAlignRight, @@ -55,8 +53,7 @@ const Attachment = { data() { return { localDescription: this.description || this.attachment.description, - nsfwImage: - useInstanceStore().instanceIdentity.nsfwCensorImage || nsfwImage, + nsfwImage: this.$store.state.instance.nsfwCensorImage || nsfwImage, hideNsfwLocal: this.$store.getters.mergedConfig.hideNsfw, preloadImage: this.$store.getters.mergedConfig.preloadImage, loading: false, @@ -107,9 +104,7 @@ const Attachment = { return 'file' }, referrerpolicy() { - return useInstanceStore().featureSet.mediaProxyAvailable - ? '' - : 'no-referrer' + return this.$store.state.instance.mediaProxyAvailable ? '' : 'no-referrer' }, type() { return fileTypeService.fileType(this.attachment.mimetype) diff --git a/src/components/auth_form/auth_form.js b/src/components/auth_form/auth_form.js index 9e05095ca..ce88aa6f9 100644 --- a/src/components/auth_form/auth_form.js +++ b/src/components/auth_form/auth_form.js @@ -1,12 +1,11 @@ import { mapState } from 'pinia' import { h, resolveComponent } from 'vue' +import { useAuthFlowStore } from 'src/stores/auth_flow' import LoginForm from '../login_form/login_form.vue' import MFARecoveryForm from '../mfa_form/recovery_form.vue' import MFATOTPForm from '../mfa_form/totp_form.vue' -import { useAuthFlowStore } from 'src/stores/auth_flow.js' - const AuthForm = { name: 'AuthForm', render() { diff --git a/src/components/avatar_list/avatar_list.js b/src/components/avatar_list/avatar_list.js index 830b64219..aad157686 100644 --- a/src/components/avatar_list/avatar_list.js +++ b/src/components/avatar_list/avatar_list.js @@ -1,8 +1,5 @@ -import UserAvatar from '../user_avatar/user_avatar.vue' - -import { useInstanceStore } from 'src/stores/instance.js' - import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' +import UserAvatar from '../user_avatar/user_avatar.vue' const AvatarList = { props: ['users'], @@ -19,7 +16,7 @@ const AvatarList = { return generateProfileLink( user.id, user.screen_name, - useInstanceStore().restrictedNicknames, + this.$store.state.instance.restrictedNicknames, ) }, }, diff --git a/src/components/basic_user_card/basic_user_card.js b/src/components/basic_user_card/basic_user_card.js index 0e45b140a..cc4cbce44 100644 --- a/src/components/basic_user_card/basic_user_card.js +++ b/src/components/basic_user_card/basic_user_card.js @@ -1,12 +1,9 @@ import RichContent from 'src/components/rich_content/rich_content.jsx' +import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import UserAvatar from '../user_avatar/user_avatar.vue' import UserLink from '../user_link/user_link.vue' import UserPopover from '../user_popover/user_popover.vue' -import { useInstanceStore } from 'src/stores/instance.js' - -import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' - const BasicUserCard = { props: ['user'], components: { @@ -20,7 +17,7 @@ const BasicUserCard = { return generateProfileLink( user.id, user.screen_name, - useInstanceStore().restrictedNicknames, + this.$store.state.instance.restrictedNicknames, ) }, }, diff --git a/src/components/block_card/block_card.js b/src/components/block_card/block_card.js index 8101394dd..7301bf0c7 100644 --- a/src/components/block_card/block_card.js +++ b/src/components/block_card/block_card.js @@ -1,9 +1,7 @@ -import { mapState } from 'pinia' +import { mapState } from 'vuex' import BasicUserCard from '../basic_user_card/basic_user_card.vue' -import { useInstanceStore } from 'src/stores/instance.js' - const BlockCard = { props: ['userId'], computed: { @@ -26,8 +24,8 @@ const BlockCard = { new Date(this.user.mute_expires_at).toLocaleString(), ]) }, - ...mapState(useInstanceStore, { - blockExpirationSupported: (store) => store.featureSet.blockExpiration, + ...mapState({ + blockExpirationSupported: (state) => state.instance.blockExpiration, }), }, components: { diff --git a/src/components/bookmark_folder_edit/bookmark_folder_edit.js b/src/components/bookmark_folder_edit/bookmark_folder_edit.js index a036895bf..a658a0f40 100644 --- a/src/components/bookmark_folder_edit/bookmark_folder_edit.js +++ b/src/components/bookmark_folder_edit/bookmark_folder_edit.js @@ -1,9 +1,8 @@ +import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders' +import { useInterfaceStore } from 'src/stores/interface' import apiService from '../../services/api/api.service' import EmojiPicker from '../emoji_picker/emoji_picker.vue' -import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js' -import { useInterfaceStore } from 'src/stores/interface.js' - const BookmarkFolderEdit = { data() { return { diff --git a/src/components/bookmark_folders/bookmark_folders.js b/src/components/bookmark_folders/bookmark_folders.js index 1147fd3a5..8e09abb31 100644 --- a/src/components/bookmark_folders/bookmark_folders.js +++ b/src/components/bookmark_folders/bookmark_folders.js @@ -1,7 +1,6 @@ +import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders' import BookmarkFolderCard from '../bookmark_folder_card/bookmark_folder_card.vue' -import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js' - const BookmarkFolders = { data() { return { diff --git a/src/components/bookmark_folders_menu/bookmark_folders_menu_content.js b/src/components/bookmark_folders_menu/bookmark_folders_menu_content.js index be1fb06ea..e84b3bc85 100644 --- a/src/components/bookmark_folders_menu/bookmark_folders_menu_content.js +++ b/src/components/bookmark_folders_menu/bookmark_folders_menu_content.js @@ -2,8 +2,7 @@ import { mapState } from 'pinia' import { getBookmarkFolderEntries } from 'src/components/navigation/filter.js' import NavigationEntry from 'src/components/navigation/navigation_entry.vue' - -import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders.js' +import { useBookmarkFoldersStore } from 'src/stores/bookmark_folders' export const BookmarkFoldersMenuContent = { props: ['showPin'], diff --git a/src/components/chat/chat.js b/src/components/chat/chat.js index caeb2aea7..6dd69ada4 100644 --- a/src/components/chat/chat.js +++ b/src/components/chat/chat.js @@ -2,6 +2,7 @@ import _ from 'lodash' import { mapState as mapPiniaState } from 'pinia' import { mapGetters, mapState } from 'vuex' +import { useInterfaceStore } from 'src/stores/interface.js' import { WSConnectionStatus } from '../../services/api/api.service.js' import chatService from '../../services/chat_service/chat_service.js' import { buildFakeMessage } from '../../services/chat_utils/chat_utils.js' @@ -16,8 +17,6 @@ import { isScrollable, } from './chat_layout_utils.js' -import { useInterfaceStore } from 'src/stores/interface.js' - import { library } from '@fortawesome/fontawesome-svg-core' import { faChevronDown, faChevronLeft } from '@fortawesome/free-solid-svg-icons' diff --git a/src/components/chat_list_item/chat_list_item.js b/src/components/chat_list_item/chat_list_item.js index 4f4ea4955..0923a8568 100644 --- a/src/components/chat_list_item/chat_list_item.js +++ b/src/components/chat_list_item/chat_list_item.js @@ -1,13 +1,12 @@ import { mapState } from 'vuex' +import fileType from 'src/services/file_type/file_type.service' import AvatarList from '../avatar_list/avatar_list.vue' import ChatTitle from '../chat_title/chat_title.vue' import StatusBody from '../status_content/status_content.vue' import Timeago from '../timeago/timeago.vue' import UserAvatar from '../user_avatar/user_avatar.vue' -import fileType from 'src/services/file_type/file_type.service' - const ChatListItem = { name: 'ChatListItem', props: ['chat'], diff --git a/src/components/chat_message/chat_message.js b/src/components/chat_message/chat_message.js index af3701ebf..f3cc495c2 100644 --- a/src/components/chat_message/chat_message.js +++ b/src/components/chat_message/chat_message.js @@ -2,6 +2,7 @@ import { mapState as mapPiniaState } from 'pinia' import { defineAsyncComponent } from 'vue' import { mapGetters, mapState } from 'vuex' +import { useInterfaceStore } from 'src/stores/interface' import Attachment from '../attachment/attachment.vue' import ChatMessageDate from '../chat_message_date/chat_message_date.vue' import Gallery from '../gallery/gallery.vue' @@ -10,9 +11,6 @@ import Popover from '../popover/popover.vue' import StatusContent from '../status_content/status_content.vue' import UserAvatar from '../user_avatar/user_avatar.vue' -import { useInstanceStore } from 'src/stores/instance.js' -import { useInterfaceStore } from 'src/stores/interface' - import { library } from '@fortawesome/fontawesome-svg-core' import { faEllipsisH, faTimes } from '@fortawesome/free-solid-svg-icons' @@ -76,7 +74,7 @@ const ChatMessage = { }), ...mapState({ currentUser: (state) => state.users.currentUser, - restrictedNicknames: (state) => useInstanceStore().restrictedNicknames, + restrictedNicknames: (state) => state.instance.restrictedNicknames, }), popoverMarginStyle() { if (this.isCurrentUser) { diff --git a/src/components/component_preview/component_preview.js b/src/components/component_preview/component_preview.js index 1d54f58de..70696f56b 100644 --- a/src/components/component_preview/component_preview.js +++ b/src/components/component_preview/component_preview.js @@ -1,6 +1,5 @@ import Checkbox from 'src/components/checkbox/checkbox.vue' import ColorInput from 'src/components/color_input/color_input.vue' - import genRandomSeed from 'src/services/random_seed/random_seed.service.js' import { adoptStyleSheets, diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index cb7cf4782..3caf4add7 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -2,14 +2,13 @@ import { clone, filter, findIndex, get, reduce } from 'lodash' import { mapState as mapPiniaState } from 'pinia' import { mapGetters, mapState } from 'vuex' +import { useInterfaceStore } from 'src/stores/interface' import { WSConnectionStatus } from '../../services/api/api.service.js' import QuickFilterSettings from '../quick_filter_settings/quick_filter_settings.vue' import QuickViewSettings from '../quick_view_settings/quick_view_settings.vue' import Status from '../status/status.vue' import ThreadTree from '../thread_tree/thread_tree.vue' -import { useInterfaceStore } from 'src/stores/interface' - import { library } from '@fortawesome/fontawesome-svg-core' import { faAngleDoubleDown, diff --git a/src/components/desktop_nav/desktop_nav.js b/src/components/desktop_nav/desktop_nav.js index a2c48ae53..8ab54b3df 100644 --- a/src/components/desktop_nav/desktop_nav.js +++ b/src/components/desktop_nav/desktop_nav.js @@ -1,10 +1,7 @@ import SearchBar from 'components/search_bar/search_bar.vue' -import { mapActions, mapState } from 'pinia' -import ConfirmModal from '../confirm_modal/confirm_modal.vue' - -import { useInstanceStore } from 'src/stores/instance.js' import { useInterfaceStore } from 'src/stores/interface' +import ConfirmModal from '../confirm_modal/confirm_modal.vue' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -54,7 +51,7 @@ export default { }), computed: { enableMask() { - return this.supportsMask && this.logoMask + return this.supportsMask && this.$store.state.instance.logoMask }, logoStyle() { return { @@ -64,7 +61,7 @@ export default { logoMaskStyle() { return this.enableMask ? { - 'mask-image': `url(${this.logo})`, + 'mask-image': `url(${this.$store.state.instance.logo})`, } : { 'background-color': this.enableMask ? '' : 'transparent', @@ -73,7 +70,7 @@ export default { logoBgStyle() { return Object.assign( { - margin: `${this.logoMargin} 0`, + margin: `${this.$store.state.instance.logoMargin} 0`, opacity: this.searchBarHidden ? 1 : 0, }, this.enableMask @@ -83,18 +80,24 @@ export default { }, ) }, - ...mapState(useInstanceStore, ['private']), - ...mapState(useInstanceStore, { - logoMask: (store) => store.instanceIdentity.logoMask, - logo: (store) => store.instanceIdentity.logo, - logoLeft: (store) => store.instanceIdentity.logoLeft, - logoMargin: (store) => store.instanceIdentity.logoMargin, - sitename: (store) => store.instanceIdentity.name, - hideSitename: (store) => store.instanceIdentity.hideSitename, - }), + logo() { + return this.$store.state.instance.logo + }, + sitename() { + return this.$store.state.instance.name + }, + hideSitename() { + return this.$store.state.instance.hideSitename + }, + logoLeft() { + return this.$store.state.instance.logoLeft + }, currentUser() { return this.$store.state.users.currentUser }, + privateMode() { + return this.$store.state.instance.private + }, shouldConfirmLogout() { return this.$store.getters.mergedConfig.modalOnLogout }, @@ -124,6 +127,11 @@ export default { onSearchBarToggled(hidden) { this.searchBarHidden = hidden }, - ...mapActions(useInterfaceStore, ['openSettingsModal']), + openSettingsModal() { + useInterfaceStore().openSettingsModal('user') + }, + openAdminModal() { + useInterfaceStore().openSettingsModal('admin') + }, }, } diff --git a/src/components/desktop_nav/desktop_nav.vue b/src/components/desktop_nav/desktop_nav.vue index da427f2a1..49382f8ee 100644 --- a/src/components/desktop_nav/desktop_nav.vue +++ b/src/components/desktop_nav/desktop_nav.vue @@ -40,7 +40,7 @@