From dbc9bd9c462ee2f3259b623dc6b34ab02728d61d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Fri, 13 Feb 2026 14:26:39 +0200 Subject: [PATCH] components --- src/components/about/about.js | 3 +- .../account_actions/account_actions.js | 5 +- src/components/attachment/attachment.js | 7 +- src/components/confirm_modal/mute_confirm.js | 6 +- src/components/conversation/conversation.js | 11 +-- src/components/desktop_nav/desktop_nav.js | 3 +- src/components/dialog_modal/dialog_modal.js | 4 +- src/components/draft/draft.js | 4 +- src/components/draft_closer/draft_closer.js | 6 +- src/components/emoji_input/emoji_input.js | 4 +- src/components/emoji_input/suggestor.js | 2 + src/components/emoji_picker/emoji_picker.js | 5 +- src/components/follow_button/follow_button.js | 4 +- .../follow_request_card.js | 4 +- src/components/link-preview/link-preview.js | 6 +- src/components/media_upload/media_upload.js | 5 +- src/components/mentions_line/mentions_line.js | 6 +- .../mobile_post_status_button.js | 5 +- src/components/notification/notification.js | 5 +- .../notifications/notification_filters.vue | 4 +- src/components/notifications/notifications.js | 7 +- src/components/poll/poll.js | 3 +- .../post_status_form/post_status_form.js | 9 +-- .../remove_follower_button.js | 4 +- .../settings_modal/helpers/setting.js | 54 ++++++++++---- .../helpers/shared_computed_object.js | 29 ++++---- .../settings_modal/settings_modal.js | 7 +- .../settings_modal/tabs/appearance_tab.vue | 8 +-- .../settings_modal/tabs/clutter_tab.vue | 4 +- .../settings_modal/tabs/composing_tab.js | 3 +- .../settings_modal/tabs/general_tab.js | 6 +- .../settings_modal/tabs/general_tab.vue | 4 +- .../settings_modal/tabs/layout_tab.js | 5 +- .../tabs/old_theme_tab/old_theme_tab.js | 3 +- src/components/status/status.js | 2 +- .../status_content/status_content.js | 3 +- src/components/still-image/still-image.js | 4 +- src/components/timeline/timeline.js | 9 ++- src/components/user_card/user_card.js | 7 +- src/components/user_card/user_card.vue | 10 +-- src/components/user_popover/user_popover.js | 16 ++--- .../user_timed_filter_modal.js | 10 +-- .../video_attachment/video_attachment.js | 6 +- src/components/who_to_follow/who_to_follow.js | 2 + test/unit/specs/components/draft.spec.js | 70 +++++++++---------- .../unit/specs/components/emoji_input.spec.js | 23 ++++-- 46 files changed, 247 insertions(+), 160 deletions(-) diff --git a/src/components/about/about.js b/src/components/about/about.js index f52d5c797..ab1ace320 100644 --- a/src/components/about/about.js +++ b/src/components/about/about.js @@ -5,6 +5,7 @@ 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' +import { useSyncConfigStore } from 'src/stores/sync_config.js' const About = { components: { @@ -21,7 +22,7 @@ const About = { showInstanceSpecificPanel() { return ( useInstanceStore().instanceIdentity.showInstanceSpecificPanel && - !this.$store.getters.mergedConfig.hideISP && + !useSyncConfigStore().mergedConfig.hideISP && useInstanceStore().instanceIdentity.instanceSpecificPanelContent ) }, diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js index 8fce4b5af..38f585675 100644 --- a/src/components/account_actions/account_actions.js +++ b/src/components/account_actions/account_actions.js @@ -8,6 +8,7 @@ import ProgressButton from '../progress_button/progress_button.vue' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useReportsStore } from 'src/stores/reports' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faEllipsisV } from '@fortawesome/free-solid-svg-icons' @@ -89,10 +90,10 @@ const AccountActions = { }, computed: { shouldConfirmBlock() { - return this.$store.getters.mergedConfig.modalOnBlock + return useSyncConfigStore().mergedConfig.modalOnBlock }, shouldConfirmRemoveUserFromFollowers() { - return this.$store.getters.mergedConfig.modalOnRemoveUserFromFollowers + return useSyncConfigStore().mergedConfig.modalOnRemoveUserFromFollowers }, ...mapState(useInstanceCapabilitiesStore, [ 'blockExpiration', diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index db5171c80..a67bd475e 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -9,6 +9,7 @@ import VideoAttachment from '../video_attachment/video_attachment.vue' import { useInstanceStore } from 'src/stores/instance.js' import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js' import { useMediaViewerStore } from 'src/stores/media_viewer' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -58,8 +59,8 @@ const Attachment = { localDescription: this.description || this.attachment.description, nsfwImage: useInstanceStore().instanceIdentity.nsfwCensorImage || nsfwImage, - hideNsfwLocal: this.$store.getters.mergedConfig.hideNsfw, - preloadImage: this.$store.getters.mergedConfig.preloadImage, + hideNsfwLocal: useSyncConfigStore().mergedConfig.hideNsfw, + preloadImage: useSyncConfigStore().mergedConfig.preloadImage, loading: false, img: fileTypeService.fileType(this.attachment.mimetype) === 'image' && @@ -93,7 +94,7 @@ const Attachment = { return this.size === 'hide' }, useContainFit() { - return this.$store.getters.mergedConfig.useContainFit + return useSyncConfigStore().mergedConfig.useContainFit }, placeholderName() { if (this.attachment.description === '' || !this.attachment.description) { diff --git a/src/components/confirm_modal/mute_confirm.js b/src/components/confirm_modal/mute_confirm.js index c486ad7e4..888aa017b 100644 --- a/src/components/confirm_modal/mute_confirm.js +++ b/src/components/confirm_modal/mute_confirm.js @@ -1,8 +1,10 @@ -import { mapGetters } from 'vuex' +import { mapState } from 'pinia' import Select from 'src/components/select/select.vue' import ConfirmModal from './confirm_modal.vue' +import { useSyncConfigStore } from 'src/stores/sync_config.js' + export default { props: ['type', 'user', 'status'], emits: ['hide', 'show', 'muted'], @@ -43,7 +45,7 @@ export default { } } }, - ...mapGetters(['mergedConfig']), + ...mapState(useSyncConfigStore, ['mergedConfig']), }, methods: { optionallyPrompt() { diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index cb7cf4782..76dd26352 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -9,6 +9,7 @@ import Status from '../status/status.vue' import ThreadTree from '../thread_tree/thread_tree.vue' import { useInterfaceStore } from 'src/stores/interface' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -81,7 +82,7 @@ const conversation = { // maxDepthInThread = max number of depths that is *visible* // since our depth starts with 0 and "showing" means "showing children" // there is a -2 here - const maxDepth = this.$store.getters.mergedConfig.maxDepthInThread - 2 + const maxDepth = useSyncConfigStore().mergedConfig.maxDepthInThread - 2 return maxDepth >= 1 ? maxDepth : 1 }, streamingEnabled() { @@ -91,22 +92,22 @@ const conversation = { ) }, displayStyle() { - return this.$store.getters.mergedConfig.conversationDisplay + return useSyncConfigStore().mergedConfig.conversationDisplay }, isTreeView() { return !this.isLinearView }, treeViewIsSimple() { - return !this.$store.getters.mergedConfig.conversationTreeAdvanced + return !useSyncConfigStore().mergedConfig.conversationTreeAdvanced }, isLinearView() { return this.displayStyle === 'linear' }, shouldFadeAncestors() { - return this.$store.getters.mergedConfig.conversationTreeFadeAncestors + return useSyncConfigStore().mergedConfig.conversationTreeFadeAncestors }, otherRepliesButtonPosition() { - return this.$store.getters.mergedConfig.conversationOtherRepliesButton + return useSyncConfigStore().mergedConfig.conversationOtherRepliesButton }, showOtherRepliesButtonBelowStatus() { return this.otherRepliesButtonPosition === 'below' diff --git a/src/components/desktop_nav/desktop_nav.js b/src/components/desktop_nav/desktop_nav.js index 943c66d1e..0871e0bd3 100644 --- a/src/components/desktop_nav/desktop_nav.js +++ b/src/components/desktop_nav/desktop_nav.js @@ -5,6 +5,7 @@ import ConfirmModal from '../confirm_modal/confirm_modal.vue' import { useInstanceStore } from 'src/stores/instance.js' import { useInterfaceStore } from 'src/stores/interface' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -96,7 +97,7 @@ export default { return this.$store.state.users.currentUser }, shouldConfirmLogout() { - return this.$store.getters.mergedConfig.modalOnLogout + return useSyncConfigStore().mergedConfig.modalOnLogout }, }, methods: { diff --git a/src/components/dialog_modal/dialog_modal.js b/src/components/dialog_modal/dialog_modal.js index 8070d3429..e5c399086 100644 --- a/src/components/dialog_modal/dialog_modal.js +++ b/src/components/dialog_modal/dialog_modal.js @@ -1,3 +1,5 @@ +import { useSyncConfigStore } from 'src/stores/sync_config.js' + const DialogModal = { props: { darkOverlay: { @@ -13,7 +15,7 @@ const DialogModal = { }, computed: { mobileCenter() { - return this.$store.getters.mergedConfig.modalMobileCenter + return useSyncConfigStore().mergedConfig.modalMobileCenter }, }, } diff --git a/src/components/draft/draft.js b/src/components/draft/draft.js index 971a75b10..5ee85dff4 100644 --- a/src/components/draft/draft.js +++ b/src/components/draft/draft.js @@ -6,6 +6,8 @@ import Gallery from 'src/components/gallery/gallery.vue' import PostStatusForm from 'src/components/post_status_form/post_status_form.vue' import StatusContent from 'src/components/status_content/status_content.vue' +import { useSyncConfigStore } from 'src/stores/sync_config.js' + import { library } from '@fortawesome/fontawesome-svg-core' import { faPollH } from '@fortawesome/free-solid-svg-icons' @@ -57,7 +59,7 @@ const Draft = { : undefined }, localCollapseSubjectDefault() { - return this.$store.getters.mergedConfig.collapseMessageWithSubject + return useSyncConfigStore().mergedConfig.collapseMessageWithSubject }, nsfwClickthrough() { if (!this.draft.nsfw) { diff --git a/src/components/draft_closer/draft_closer.js b/src/components/draft_closer/draft_closer.js index d724ab4ac..5f297bf4c 100644 --- a/src/components/draft_closer/draft_closer.js +++ b/src/components/draft_closer/draft_closer.js @@ -1,5 +1,7 @@ import DialogModal from 'src/components/dialog_modal/dialog_modal.vue' +import { useSyncConfigStore } from 'src/stores/sync_config.js' + const DraftCloser = { data() { return { @@ -12,10 +14,10 @@ const DraftCloser = { emits: ['save', 'discard'], computed: { action() { - if (this.$store.getters.mergedConfig.autoSaveDraft) { + if (useSyncConfigStore().mergedConfig.autoSaveDraft) { return 'save' } else { - return this.$store.getters.mergedConfig.unsavedPostAction + return useSyncConfigStore().mergedConfig.unsavedPostAction } }, shouldConfirm() { diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 24794640e..23de501de 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -9,6 +9,8 @@ import genRandomSeed from '../../services/random_seed/random_seed.service.js' import EmojiPicker from '../emoji_picker/emoji_picker.vue' import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_indicator.vue' +import { useSyncConfigStore } from 'src/stores/sync_config.js' + import { library } from '@fortawesome/fontawesome-svg-core' import { faSmileBeam } from '@fortawesome/free-regular-svg-icons' @@ -131,7 +133,7 @@ const EmojiInput = { }, computed: { padEmoji() { - return this.$store.getters.mergedConfig.padEmoji + return useSyncConfigStore().mergedConfig.padEmoji }, defaultCandidateIndex() { return this.$store.getters.mergedConfig.autocompleteSelect ? 0 : -1 diff --git a/src/components/emoji_input/suggestor.js b/src/components/emoji_input/suggestor.js index c478fea67..c0d8f7ca1 100644 --- a/src/components/emoji_input/suggestor.js +++ b/src/components/emoji_input/suggestor.js @@ -1,3 +1,5 @@ +import { useEmojiStore } from 'src/stores/emoji.js' + /** * suggest - generates a suggestor function to be used by emoji-input * data: object providing source information for specific types of suggestions: diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 79c0ab47e..1e4594b2c 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -8,6 +8,7 @@ import StillImage from '../still-image/still-image.vue' import { useEmojiStore } from 'src/stores/emoji.js' import { useInstanceStore } from 'src/stores/instance.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -340,7 +341,7 @@ const EmojiPicker = { this.$nextTick(() => { this.updateEmojiSize() }) - return this.$store.getters.mergedConfig.fontSize + return useSyncConfigStore().mergedConfig.fontSize }, emojiHeight() { return this.emojiSize @@ -405,7 +406,7 @@ const EmojiPicker = { }, languages() { return ensureFinalFallback( - this.$store.getters.mergedConfig.interfaceLanguage, + useSyncConfigStore().mergedConfig.interfaceLanguage, ) }, maybeLocalizedEmojiName() { diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js index eb545b28d..539749bc8 100644 --- a/src/components/follow_button/follow_button.js +++ b/src/components/follow_button/follow_button.js @@ -3,6 +3,8 @@ import { requestUnfollow, } from '../../services/follow_manipulate/follow_manipulate' import ConfirmModal from '../confirm_modal/confirm_modal.vue' + +import { useSyncConfigStore } from 'src/stores/sync_config.js' export default { props: ['relationship', 'user', 'labelFollowing', 'buttonClass'], components: { @@ -16,7 +18,7 @@ export default { }, computed: { shouldConfirmUnfollow() { - return this.$store.getters.mergedConfig.modalOnUnfollow + return useSyncConfigStore().mergedConfig.modalOnUnfollow }, isPressed() { return this.inProgress || this.relationship.following diff --git a/src/components/follow_request_card/follow_request_card.js b/src/components/follow_request_card/follow_request_card.js index c037ddf42..b7959a2d3 100644 --- a/src/components/follow_request_card/follow_request_card.js +++ b/src/components/follow_request_card/follow_request_card.js @@ -2,6 +2,8 @@ import { notificationsFromStore } from '../../services/notification_utils/notifi import BasicUserCard from '../basic_user_card/basic_user_card.vue' import ConfirmModal from '../confirm_modal/confirm_modal.vue' +import { useSyncConfigStore } from 'src/stores/sync_config.js' + const FollowRequestCard = { props: ['user'], components: { @@ -76,7 +78,7 @@ const FollowRequestCard = { }, computed: { mergedConfig() { - return this.$store.getters.mergedConfig + return useSyncConfigStore().mergedConfig }, shouldConfirmApprove() { return this.mergedConfig.modalOnApproveFollow diff --git a/src/components/link-preview/link-preview.js b/src/components/link-preview/link-preview.js index ac91f916d..a465cc213 100644 --- a/src/components/link-preview/link-preview.js +++ b/src/components/link-preview/link-preview.js @@ -1,4 +1,6 @@ -import { mapGetters } from 'vuex' +import { mapState } from 'pinia' + +import { useSyncConfigStore } from 'src/stores/sync_config.js' const LinkPreview = { name: 'LinkPreview', @@ -24,7 +26,7 @@ const LinkPreview = { hideNsfwConfig() { return this.mergedConfig.hideNsfw }, - ...mapGetters(['mergedConfig']), + ...mapState(useSyncConfigStore, ['mergedConfig']), }, created() { if (this.useImage) { diff --git a/src/components/media_upload/media_upload.js b/src/components/media_upload/media_upload.js index ee61fa369..be62142c6 100644 --- a/src/components/media_upload/media_upload.js +++ b/src/components/media_upload/media_upload.js @@ -2,6 +2,7 @@ import fileSizeFormatService from '../../services/file_size_format/file_size_for import statusPosterService from '../../services/status_poster/status_poster.service.js' import { useInstanceStore } from 'src/stores/instance.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faCircleNotch, faUpload } from '@fortawesome/free-solid-svg-icons' @@ -33,7 +34,7 @@ const mediaUpload = { } // Skip if image compression is disabled - if (!this.$store.getters.mergedConfig.imageCompression) { + if (!useSyncConfigStore().mergedConfig.imageCompression) { return file } @@ -78,7 +79,7 @@ const mediaUpload = { // Convert to WebP if supported and alwaysUseJpeg is false, otherwise JPEG const type = - !this.$store.getters.mergedConfig.alwaysUseJpeg && supportsWebP + !useSyncConfigStore().mergedConfig.alwaysUseJpeg && supportsWebP ? 'image/webp' : 'image/jpeg' const extension = type === 'image/webp' ? '.webp' : '.jpg' diff --git a/src/components/mentions_line/mentions_line.js b/src/components/mentions_line/mentions_line.js index e6aa392a0..bd3882866 100644 --- a/src/components/mentions_line/mentions_line.js +++ b/src/components/mentions_line/mentions_line.js @@ -1,7 +1,9 @@ -import { mapGetters } from 'vuex' +import { mapState } from 'pinia' import MentionLink from 'src/components/mention_link/mention_link.vue' +import { useSyncConfigStore } from 'src/stores/sync_config.js' + export const MENTIONS_LIMIT = 5 const MentionsLine = { @@ -26,7 +28,7 @@ const MentionsLine = { manyMentions() { return this.extraMentions.length > 0 }, - ...mapGetters(['mergedConfig']), + ...mapState(useSyncConfigStore, ['mergedConfig']), }, methods: { toggleShowMore() { diff --git a/src/components/mobile_post_status_button/mobile_post_status_button.js b/src/components/mobile_post_status_button/mobile_post_status_button.js index 83103c827..594cd6688 100644 --- a/src/components/mobile_post_status_button/mobile_post_status_button.js +++ b/src/components/mobile_post_status_button/mobile_post_status_button.js @@ -1,6 +1,7 @@ import { debounce } from 'lodash' import { usePostStatusStore } from 'src/stores/post_status.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import { library } from '@fortawesome/fontawesome-svg-core' import { faPen } from '@fortawesome/free-solid-svg-icons' @@ -45,10 +46,10 @@ const MobilePostStatusButton = { ) }, isPersistent() { - return !!this.$store.getters.mergedConfig.alwaysShowNewPostButton + return !!useSyncConfigStore().mergedConfig.alwaysShowNewPostButton }, autohideFloatingPostButton() { - return !!this.$store.getters.mergedConfig.autohideFloatingPostButton + return !!useSyncConfigStore().mergedConfig.autohideFloatingPostButton }, }, watch: { diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 16084dee4..f3f5b76da 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -17,6 +17,7 @@ import UserLink from '../user_link/user_link.vue' import UserPopover from '../user_popover/user_popover.vue' import { useInstanceStore } from 'src/stores/instance.js' +import { useSyncConfigStore } from 'src/stores/sync_config.js' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' @@ -181,7 +182,7 @@ const Notification = { return highlightClass(this.notification.from_profile) }, userStyle() { - const highlight = this.$store.getters.mergedConfig.highlight + const highlight = useSyncConfigStore().mergedConfig.highlight const user = this.notification.from_profile return highlightStyle(highlight[user.screen_name]) }, @@ -209,7 +210,7 @@ const Notification = { return isStatusNotification(this.notification.type) }, mergedConfig() { - return this.$store.getters.mergedConfig + return useSyncConfigStore().mergedConfig }, shouldConfirmApprove() { return this.mergedConfig.modalOnApproveFollow diff --git a/src/components/notifications/notification_filters.vue b/src/components/notifications/notification_filters.vue index 7be8eb76b..5508e03ac 100644 --- a/src/components/notifications/notification_filters.vue +++ b/src/components/notifications/notification_filters.vue @@ -108,6 +108,8 @@