even more getter fixes
This commit is contained in:
parent
7738ce87e6
commit
ca0da60bcd
24 changed files with 93 additions and 56 deletions
14
src/App.js
14
src/App.js
|
|
@ -1,9 +1,6 @@
|
||||||
import { throttle } from 'lodash'
|
import { throttle } from 'lodash'
|
||||||
import { mapState } from 'pinia'
|
import { mapState } from 'pinia'
|
||||||
import { defineAsyncComponent } from 'vue'
|
import { defineAsyncComponent } from 'vue'
|
||||||
import { mapGetters } from 'vuex'
|
|
||||||
import messages from 'src/i18n/messages'
|
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
|
||||||
|
|
||||||
import DesktopNav from './components/desktop_nav/desktop_nav.vue'
|
import DesktopNav from './components/desktop_nav/desktop_nav.vue'
|
||||||
import EditStatusModal from './components/edit_status_modal/edit_status_modal.vue'
|
import EditStatusModal from './components/edit_status_modal/edit_status_modal.vue'
|
||||||
|
|
@ -24,14 +21,17 @@ import WhoToFollowPanel from './components/who_to_follow_panel/who_to_follow_pan
|
||||||
import { getOrCreateServiceWorker } from './services/sw/sw'
|
import { getOrCreateServiceWorker } from './services/sw/sw'
|
||||||
import { windowHeight, windowWidth } from './services/window_utils/window_utils'
|
import { windowHeight, windowWidth } from './services/window_utils/window_utils'
|
||||||
|
|
||||||
import { useI18nStore } from 'src/stores/i18n.js'
|
|
||||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||||
|
import { useI18nStore } from 'src/stores/i18n.js'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
import { useShoutStore } from 'src/stores/shout.js'
|
import { useShoutStore } from 'src/stores/shout.js'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
|
import messages from 'src/i18n/messages'
|
||||||
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'app',
|
name: 'app',
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -142,7 +142,9 @@ export default {
|
||||||
return this.currentUser.background_image
|
return this.currentUser.background_image
|
||||||
},
|
},
|
||||||
instanceBackground() {
|
instanceBackground() {
|
||||||
return useSyncConfigStore().mergedConfig.hideInstanceWallpaper ? null : this.instanceBackgroundUrl
|
return useSyncConfigStore().mergedConfig.hideInstanceWallpaper
|
||||||
|
? null
|
||||||
|
: this.instanceBackgroundUrl
|
||||||
},
|
},
|
||||||
background() {
|
background() {
|
||||||
return this.userBackground || this.instanceBackground
|
return this.userBackground || this.instanceBackground
|
||||||
|
|
@ -203,7 +205,7 @@ export default {
|
||||||
!useSyncConfigStore().mergedConfig.hideISP
|
!useSyncConfigStore().mergedConfig.hideISP
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||||
...mapState(useInterfaceStore, [
|
...mapState(useInterfaceStore, [
|
||||||
'themeApplied',
|
'themeApplied',
|
||||||
'styleDataUsed',
|
'styleDataUsed',
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ import { useI18nStore } from 'src/stores/i18n'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
||||||
import { useOAuthStore } from 'src/stores/oauth'
|
import { useOAuthStore } from 'src/stores/oauth'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
import { useLocalConfigStore } from 'src/stores/local_config.js'
|
|
||||||
|
|
||||||
import VBodyScrollLock from 'src/directives/body_scroll_lock'
|
import VBodyScrollLock from 'src/directives/body_scroll_lock'
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { mapGetters } from 'vuex'
|
import { mapState } from 'pinia'
|
||||||
|
|
||||||
import nsfwImage from '../../assets/nsfw.png'
|
import nsfwImage from '../../assets/nsfw.png'
|
||||||
import fileTypeService from '../../services/file_type/file_type.service.js'
|
import fileTypeService from '../../services/file_type/file_type.service.js'
|
||||||
|
|
@ -140,7 +140,7 @@ const Attachment = {
|
||||||
videoTag() {
|
videoTag() {
|
||||||
return this.useModal ? 'button' : 'span'
|
return this.useModal ? 'button' : 'span'
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'attachment.description'(newVal) {
|
'attachment.description'(newVal) {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import UserAvatar from '../user_avatar/user_avatar.vue'
|
||||||
|
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faEllipsisH, faTimes } from '@fortawesome/free-solid-svg-icons'
|
import { faEllipsisH, faTimes } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
@ -85,7 +86,7 @@ const ChatMessage = {
|
||||||
return { left: 50 }
|
return { left: 50 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig', 'findUser']),
|
...mapPiniaState(useSyncConfigStore, ['mergedConfig', 'findUser']),
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { clone, filter, findIndex, get, reduce } from 'lodash'
|
import { clone, filter, findIndex, get, reduce } from 'lodash'
|
||||||
import { mapState as mapPiniaState } from 'pinia'
|
import { mapState as mapPiniaState } from 'pinia'
|
||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
import { WSConnectionStatus } from '../../services/api/api.service.js'
|
import { WSConnectionStatus } from '../../services/api/api.service.js'
|
||||||
import QuickFilterSettings from '../quick_filter_settings/quick_filter_settings.vue'
|
import QuickFilterSettings from '../quick_filter_settings/quick_filter_settings.vue'
|
||||||
|
|
@ -393,7 +393,7 @@ const conversation = {
|
||||||
maybeHighlight() {
|
maybeHighlight() {
|
||||||
return this.isExpanded ? this.highlight : null
|
return this.isExpanded ? this.highlight : null
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapPiniaState(useSyncConfigStore, ['mergedConfig']),
|
||||||
...mapState({
|
...mapState({
|
||||||
mastoUserSocketStatus: (state) => state.api.mastoUserSocketStatus,
|
mastoUserSocketStatus: (state) => state.api.mastoUserSocketStatus,
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
import { useAnnouncementsStore } from 'src/stores/announcements.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
|
import { mapState as mapPiniaState } from 'pinia'
|
||||||
import { defineAsyncComponent } from 'vue'
|
import { defineAsyncComponent } from 'vue'
|
||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapGetters, mapState } from 'vuex'
|
||||||
import { mapState as mapPiniaState } from 'pinia'
|
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
highlightClass,
|
highlightClass,
|
||||||
|
|
@ -10,6 +9,8 @@ import {
|
||||||
import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_indicator.vue'
|
import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_indicator.vue'
|
||||||
import UserAvatar from '../user_avatar/user_avatar.vue'
|
import UserAvatar from '../user_avatar/user_avatar.vue'
|
||||||
|
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
|
|
||||||
|
|
@ -412,7 +412,7 @@ const PostStatusForm = {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||||
...mapState(useInterfaceStore, {
|
...mapState(useInterfaceStore, {
|
||||||
mobileLayout: (store) => store.mobileLayout,
|
mobileLayout: (store) => store.mobileLayout,
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { mapState } from 'pinia'
|
import { mapState } from 'pinia'
|
||||||
import { mapGetters } from 'vuex'
|
|
||||||
|
|
||||||
import Popover from '../popover/popover.vue'
|
import Popover from '../popover/popover.vue'
|
||||||
|
|
||||||
import { useInterfaceStore } from 'src/stores/interface.js'
|
import { useInterfaceStore } from 'src/stores/interface.js'
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import { faFilter, faFont, faWrench } from '@fortawesome/free-solid-svg-icons'
|
import { faFilter, faFont, faWrench } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
@ -31,7 +31,7 @@ const QuickFilterSettings = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['mergedConfig']),
|
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||||
...mapState(useInterfaceStore, {
|
...mapState(useInterfaceStore, {
|
||||||
mobileLayout: (state) => state.layoutType === 'mobile',
|
mobileLayout: (state) => state.layoutType === 'mobile',
|
||||||
}),
|
}),
|
||||||
|
|
@ -87,7 +87,10 @@ const QuickFilterSettings = {
|
||||||
},
|
},
|
||||||
set() {
|
set() {
|
||||||
const value = !this.hideMedia
|
const value = !this.hideMedia
|
||||||
useSyncConfigStore().setSimplePrefAndSave({ path: 'hideAttachments', value })
|
useSyncConfigStore().setSimplePrefAndSave({
|
||||||
|
path: 'hideAttachments',
|
||||||
|
value,
|
||||||
|
})
|
||||||
useSyncConfigStore().setSimplePrefAndSave({
|
useSyncConfigStore().setSimplePrefAndSave({
|
||||||
path: 'hideAttachmentsInConv',
|
path: 'hideAttachmentsInConv',
|
||||||
value,
|
value,
|
||||||
|
|
@ -112,7 +115,10 @@ const QuickFilterSettings = {
|
||||||
},
|
},
|
||||||
set() {
|
set() {
|
||||||
const value = !this.muteBotStatuses
|
const value = !this.muteBotStatuses
|
||||||
useSyncConfigStore().setSimplePrefAndSave({ path: 'muteBotStatuses', value })
|
useSyncConfigStore().setSimplePrefAndSave({
|
||||||
|
path: 'muteBotStatuses',
|
||||||
|
value,
|
||||||
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
muteSensitiveStatuses: {
|
muteSensitiveStatuses: {
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,10 @@ export default {
|
||||||
const writePath = `simple.${readPath}`
|
const writePath = `simple.${readPath}`
|
||||||
|
|
||||||
if (!this.timedApplyMode) {
|
if (!this.timedApplyMode) {
|
||||||
useSyncConfigStore().setSimplePrefAndSave({ path: writePath, value })
|
useSyncConfigStore().setSimplePrefAndSave({
|
||||||
|
path: writePath,
|
||||||
|
value,
|
||||||
|
})
|
||||||
useSyncConfigStore().pushSyncConfig()
|
useSyncConfigStore().pushSyncConfig()
|
||||||
} else {
|
} else {
|
||||||
if (useInterfaceStore().temporaryChangesTimeoutId !== null) {
|
if (useInterfaceStore().temporaryChangesTimeoutId !== null) {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
import UnitSetting from '../helpers/unit_setting.vue'
|
import UnitSetting from '../helpers/unit_setting.vue'
|
||||||
|
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import IntegerSetting from '../helpers/integer_setting.vue'
|
||||||
import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
|
import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
|
||||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
|
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
const GeneralTab = {
|
const GeneralTab = {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ import { useAnnouncementsStore } from 'src/stores/announcements'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useInterfaceStore } from 'src/stores/interface'
|
import { useInterfaceStore } from 'src/stores/interface'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
|
||||||
import { useShoutStore } from 'src/stores/shout'
|
import { useShoutStore } from 'src/stores/shout'
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import { useEditStatusStore } from 'src/stores/editStatus.js'
|
import { useEditStatusStore } from 'src/stores/editStatus.js'
|
||||||
import { useInstanceStore } from 'src/stores/instance.js'
|
import { useInstanceStore } from 'src/stores/instance.js'
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
|
||||||
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
||||||
import { useReportsStore } from 'src/stores/reports.js'
|
import { useReportsStore } from 'src/stores/reports.js'
|
||||||
import { useStatusHistoryStore } from 'src/stores/statusHistory.js'
|
import { useStatusHistoryStore } from 'src/stores/statusHistory.js'
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
const PRIVATE_SCOPES = new Set(['private', 'direct'])
|
const PRIVATE_SCOPES = new Set(['private', 'direct'])
|
||||||
const PUBLIC_SCOPES = new Set(['public', 'unlisted'])
|
const PUBLIC_SCOPES = new Set(['public', 'unlisted'])
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import { mapGetters } from 'vuex'
|
import { mapState } from 'pinia'
|
||||||
|
|
||||||
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
import RichContent from 'src/components/rich_content/rich_content.jsx'
|
||||||
|
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import fileType from 'src/services/file_type/file_type.service'
|
import fileType from 'src/services/file_type/file_type.service'
|
||||||
|
|
||||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
|
@ -110,7 +112,7 @@ const StatusBody = {
|
||||||
collapsedStatus() {
|
collapsedStatus() {
|
||||||
return this.status.raw_html.replace(/(\n|<br\s?\/?>)/g, ' ')
|
return this.status.raw_html.replace(/(\n|<br\s?\/?>)/g, ' ')
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
RichContent,
|
RichContent,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { mapState as mapPiniaState } from 'pinia'
|
||||||
import { mapGetters, mapState } from 'vuex'
|
import { mapGetters, mapState } from 'vuex'
|
||||||
|
|
||||||
import StatusBody from 'src/components/status_body/status_body.vue'
|
import StatusBody from 'src/components/status_body/status_body.vue'
|
||||||
|
|
@ -123,7 +124,7 @@ const StatusContent = {
|
||||||
maxThumbnails() {
|
maxThumbnails() {
|
||||||
return this.mergedConfig.maxThumbnails
|
return this.mergedConfig.maxThumbnails
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapPiniaState(useSyncConfigStore, ['mergedConfig']),
|
||||||
...mapState({
|
...mapState({
|
||||||
currentUser: (state) => state.users.currentUser,
|
currentUser: (state) => state.users.currentUser,
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
||||||
|
|
||||||
import * as DateUtils from 'src/services/date_utils/date_utils.js'
|
import * as DateUtils from 'src/services/date_utils/date_utils.js'
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
|
|
||||||
import { useSyncConfigStore } from 'src/stores/sync_config.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Timeago',
|
name: 'Timeago',
|
||||||
props: ['time', 'autoUpdate', 'longFormat', 'nowThreshold', 'templateKey'],
|
props: ['time', 'autoUpdate', 'longFormat', 'nowThreshold', 'templateKey'],
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import isEqual from 'lodash/isEqual'
|
import isEqual from 'lodash/isEqual'
|
||||||
import merge from 'lodash/merge'
|
import merge from 'lodash/merge'
|
||||||
import ldUnescape from 'lodash/unescape'
|
import ldUnescape from 'lodash/unescape'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapState } from 'pinia'
|
||||||
|
|
||||||
import Checkbox from 'src/components/checkbox/checkbox.vue'
|
import Checkbox from 'src/components/checkbox/checkbox.vue'
|
||||||
import ColorInput from 'src/components/color_input/color_input.vue'
|
import ColorInput from 'src/components/color_input/color_input.vue'
|
||||||
|
|
@ -243,7 +243,7 @@ export default {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||||
},
|
},
|
||||||
userHighlightColor: {
|
userHighlightColor: {
|
||||||
get() {
|
get() {
|
||||||
|
|
@ -391,7 +391,7 @@ export default {
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapState(useSyncConfigStore, ['mergedConfig']),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
muteUser() {
|
muteUser() {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ const mastoApiNotificationTypes = new Set([
|
||||||
|
|
||||||
const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
const fetchAndUpdate = ({ store, credentials, older = false, since }) => {
|
||||||
const args = { credentials }
|
const args = { credentials }
|
||||||
const { getters } = store
|
|
||||||
const rootState = store.rootState || store.state
|
const rootState = store.rootState || store.state
|
||||||
const timelineData = rootState.notifications
|
const timelineData = rootState.notifications
|
||||||
const hideMutedPosts = useSyncConfigStore().mergedConfig.hideMutedPosts
|
const hideMutedPosts = useSyncConfigStore().mergedConfig.hideMutedPosts
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ const fetchAndUpdate = ({
|
||||||
}) => {
|
}) => {
|
||||||
const args = { timeline, credentials }
|
const args = { timeline, credentials }
|
||||||
const rootState = store.rootState || store.state
|
const rootState = store.rootState || store.state
|
||||||
const { getters } = store
|
|
||||||
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
|
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
|
||||||
const { hideMutedPosts, replyVisibility } = useSyncConfigStore().mergedConfig
|
const { hideMutedPosts, replyVisibility } = useSyncConfigStore().mergedConfig
|
||||||
const loggedIn = !!rootState.users.currentUser
|
const loggedIn = !!rootState.users.currentUser
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
|
import { defineStore } from 'pinia'
|
||||||
|
|
||||||
import messages from 'src/i18n/messages'
|
import messages from 'src/i18n/messages'
|
||||||
import localeService from 'src/services/locale/locale.service.js'
|
import localeService from 'src/services/locale/locale.service.js'
|
||||||
import { defineStore } from 'pinia'
|
|
||||||
|
|
||||||
const BACKEND_LANGUAGE_COOKIE_NAME = 'userLanguage'
|
const BACKEND_LANGUAGE_COOKIE_NAME = 'userLanguage'
|
||||||
|
|
||||||
|
|
@ -21,6 +22,6 @@ export const useI18nStore = defineStore('i18n', {
|
||||||
BACKEND_LANGUAGE_COOKIE_NAME,
|
BACKEND_LANGUAGE_COOKIE_NAME,
|
||||||
localeService.internalToBackendLocaleMulti(value),
|
localeService.internalToBackendLocaleMulti(value),
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,10 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
this.resetThemeV3Palette()
|
this.resetThemeV3Palette()
|
||||||
this.resetThemeV2()
|
this.resetThemeV2()
|
||||||
|
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.paletteCustomData', value })
|
useSyncConfigStore().setPreference({
|
||||||
|
path: 'simple.paletteCustomData',
|
||||||
|
value,
|
||||||
|
})
|
||||||
useSyncConfigStore().pushSyncConfig()
|
useSyncConfigStore().pushSyncConfig()
|
||||||
|
|
||||||
this.applyTheme({ recompile: true })
|
this.applyTheme({ recompile: true })
|
||||||
|
|
@ -292,7 +295,10 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
this.resetThemeV2()
|
this.resetThemeV2()
|
||||||
this.resetThemeV3Palette()
|
this.resetThemeV3Palette()
|
||||||
|
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.styleCustomData', value })
|
useSyncConfigStore().setPreference({
|
||||||
|
path: 'simple.styleCustomData',
|
||||||
|
value,
|
||||||
|
})
|
||||||
useSyncConfigStore().pushSyncConfig()
|
useSyncConfigStore().pushSyncConfig()
|
||||||
|
|
||||||
this.useStylePalette = true
|
this.useStylePalette = true
|
||||||
|
|
@ -330,18 +336,27 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
this.resetThemeV2()
|
this.resetThemeV2()
|
||||||
|
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.customTheme', value })
|
useSyncConfigStore().setPreference({ path: 'simple.customTheme', value })
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.customThemeSource', value })
|
useSyncConfigStore().setPreference({
|
||||||
|
path: 'simple.customThemeSource',
|
||||||
|
value,
|
||||||
|
})
|
||||||
useSyncConfigStore().pushSyncConfig()
|
useSyncConfigStore().pushSyncConfig()
|
||||||
|
|
||||||
this.applyTheme({ recompile: true })
|
this.applyTheme({ recompile: true })
|
||||||
},
|
},
|
||||||
resetThemeV3() {
|
resetThemeV3() {
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.style', value: null })
|
useSyncConfigStore().setPreference({ path: 'simple.style', value: null })
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.styleCustomData', value: null })
|
useSyncConfigStore().setPreference({
|
||||||
|
path: 'simple.styleCustomData',
|
||||||
|
value: null,
|
||||||
|
})
|
||||||
useSyncConfigStore().pushSyncConfig()
|
useSyncConfigStore().pushSyncConfig()
|
||||||
},
|
},
|
||||||
resetThemeV3Palette() {
|
resetThemeV3Palette() {
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.palette', value: null })
|
useSyncConfigStore().setPreference({
|
||||||
|
path: 'simple.palette',
|
||||||
|
value: null,
|
||||||
|
})
|
||||||
useSyncConfigStore().setPreference({
|
useSyncConfigStore().setPreference({
|
||||||
path: 'simple.paletteCustomData',
|
path: 'simple.paletteCustomData',
|
||||||
value: null,
|
value: null,
|
||||||
|
|
@ -350,7 +365,10 @@ export const useInterfaceStore = defineStore('interface', {
|
||||||
},
|
},
|
||||||
resetThemeV2() {
|
resetThemeV2() {
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.theme', value: null })
|
useSyncConfigStore().setPreference({ path: 'simple.theme', value: null })
|
||||||
useSyncConfigStore().setPreference({ path: 'simple.customTheme', value: null })
|
useSyncConfigStore().setPreference({
|
||||||
|
path: 'simple.customTheme',
|
||||||
|
value: null,
|
||||||
|
})
|
||||||
useSyncConfigStore().setPreference({
|
useSyncConfigStore().setPreference({
|
||||||
path: 'simple.customThemeSource',
|
path: 'simple.customThemeSource',
|
||||||
value: null,
|
value: null,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
import {
|
import { cloneDeep, set } from 'lodash'
|
||||||
cloneDeep,
|
|
||||||
set,
|
|
||||||
} from 'lodash'
|
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { toRaw } from 'vue'
|
import { toRaw } from 'vue'
|
||||||
|
|
||||||
|
|
@ -12,7 +9,7 @@ import { defaultState as configDefaultState } from 'src/modules/default_config_s
|
||||||
export const defaultState = {
|
export const defaultState = {
|
||||||
prefsStorage: {
|
prefsStorage: {
|
||||||
...configDefaultState,
|
...configDefaultState,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useLocalConfigStore = defineStore('local_config', {
|
export const useLocalConfigStore = defineStore('local_config', {
|
||||||
|
|
|
||||||
|
|
@ -97,14 +97,18 @@ const _verifyPrefs = (state) => {
|
||||||
if (typeof v === 'undefined') return
|
if (typeof v === 'undefined') return
|
||||||
if (typeof v === 'number' || typeof v === 'boolean') return
|
if (typeof v === 'number' || typeof v === 'boolean') return
|
||||||
if (typeof v === 'object') return
|
if (typeof v === 'object') return
|
||||||
console.warn(`Preference simple.${k} as invalid type ${typeof v}, reinitializing`)
|
console.warn(
|
||||||
|
`Preference simple.${k} as invalid type ${typeof v}, reinitializing`,
|
||||||
|
)
|
||||||
set(state.prefsStorage.simple, k, defaultState.prefsStorage.simple[k])
|
set(state.prefsStorage.simple, k, defaultState.prefsStorage.simple[k])
|
||||||
})
|
})
|
||||||
|
|
||||||
// Collections
|
// Collections
|
||||||
Object.entries(defaultState.prefsStorage.collections).forEach(([k, v]) => {
|
Object.entries(defaultState.prefsStorage.collections).forEach(([k, v]) => {
|
||||||
if (Array.isArray(v)) return
|
if (Array.isArray(v)) return
|
||||||
console.warn(`Preference collections.${k} as invalid type ${typeof v}, reinitializing`)
|
console.warn(
|
||||||
|
`Preference collections.${k} as invalid type ${typeof v}, reinitializing`,
|
||||||
|
)
|
||||||
set(
|
set(
|
||||||
state.prefsStorage.collections,
|
state.prefsStorage.collections,
|
||||||
k,
|
k,
|
||||||
|
|
@ -306,7 +310,9 @@ export const _mergePrefs = (recent, stale) => {
|
||||||
break
|
break
|
||||||
case 'addToCollection':
|
case 'addToCollection':
|
||||||
if (!path.startsWith('collections')) {
|
if (!path.startsWith('collections')) {
|
||||||
return console.error('Illegal operation "addToCollection" on a non-collection')
|
return console.error(
|
||||||
|
'Illegal operation "addToCollection" on a non-collection',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
set(
|
set(
|
||||||
resultOutput,
|
resultOutput,
|
||||||
|
|
@ -316,7 +322,9 @@ export const _mergePrefs = (recent, stale) => {
|
||||||
break
|
break
|
||||||
case 'removeFromCollection': {
|
case 'removeFromCollection': {
|
||||||
if (!path.startsWith('collections')) {
|
if (!path.startsWith('collections')) {
|
||||||
return console.error('Illegal operation "removeFromCollection" on a non-collection')
|
return console.error(
|
||||||
|
'Illegal operation "removeFromCollection" on a non-collection',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
const newSet = new Set(get(resultOutput, path))
|
const newSet = new Set(get(resultOutput, path))
|
||||||
newSet.delete(args[0])
|
newSet.delete(args[0])
|
||||||
|
|
@ -438,9 +446,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
`Tried to edit internal (starts with _) field '${path}', ignoring.`,
|
`Tried to edit internal (starts with _) field '${path}', ignoring.`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (
|
if (path.startsWith('collections')) {
|
||||||
path.startsWith('collections')
|
|
||||||
) {
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Invalid operation 'set' for collection field '${path}', ignoring.`,
|
`Invalid operation 'set' for collection field '${path}', ignoring.`,
|
||||||
)
|
)
|
||||||
|
|
@ -468,9 +474,7 @@ export const useSyncConfigStore = defineStore('sync_config', {
|
||||||
`Tried to edit internal (starts with _) field '${path}', ignoring.`,
|
`Tried to edit internal (starts with _) field '${path}', ignoring.`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (
|
if (path.startsWith('collections')) {
|
||||||
path.startsWith('collections')
|
|
||||||
) {
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Invalid operation 'unset' for collection field '${path}', ignoring.`,
|
`Invalid operation 'unset' for collection field '${path}', ignoring.`,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue