Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85823618
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
9 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/components/extra_notifications/extra_notifications.js b/src/components/extra_notifications/extra_notifications.js
index e00f58beca..67be591440 100644
--- a/src/components/extra_notifications/extra_notifications.js
+++ b/src/components/extra_notifications/extra_notifications.js
@@ -1,73 +1,74 @@
import { mapState as mapPiniaState } from 'pinia'
import { mapGetters } from 'vuex'
import { useAnnouncementsStore } from 'src/stores/announcements.js'
import { useInterfaceStore } from 'src/stores/interface.js'
import { useSyncConfigStore } from 'src/stores/sync_config.js'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faBullhorn,
faComments,
faUserPlus,
} from '@fortawesome/free-solid-svg-icons'
library.add(faUserPlus, faComments, faBullhorn)
const ExtraNotifications = {
computed: {
shouldShowChats() {
return (
this.mergedConfig.showExtraNotifications &&
this.mergedConfig.showChatsInExtraNotifications &&
this.unreadChatCount
)
},
shouldShowAnnouncements() {
return (
this.mergedConfig.showExtraNotifications &&
this.mergedConfig.showAnnouncementsInExtraNotifications &&
this.unreadAnnouncementCount
)
},
shouldShowFollowRequests() {
return (
this.mergedConfig.showExtraNotifications &&
this.mergedConfig.showFollowRequestsInExtraNotifications &&
this.followRequestCount
)
},
hasAnythingToShow() {
return (
this.shouldShowChats ||
this.shouldShowAnnouncements ||
this.shouldShowFollowRequests
)
},
shouldShowCustomizationTip() {
return (
this.mergedConfig.showExtraNotificationsTip && this.hasAnythingToShow
)
},
currentUser() {
return this.$store.state.users.currentUser
},
- ...mapGetters(['unreadChatCount', 'followRequestCount', 'mergedConfig']),
+ ...mapGetters(['unreadChatCount', 'followRequestCount']),
...mapPiniaState(useAnnouncementsStore, {
unreadAnnouncementCount: 'unreadAnnouncementCount',
}),
+ ...mapPiniaState(useSyncConfigStore, ['mergedConfig']),
},
methods: {
openNotificationSettings() {
return useInterfaceStore().openSettingsModalTab('notifications')
},
dismissConfigurationTip() {
return useSyncConfigStore().setSimplePrefAndSave({
path: 'showExtraNotificationsTip',
value: false,
})
},
},
}
export default ExtraNotifications
diff --git a/src/modules/config.js b/src/modules/config.js
deleted file mode 100644
index b68d547df0..0000000000
--- a/src/modules/config.js
+++ /dev/null
@@ -1,200 +0,0 @@
-import Cookies from 'js-cookie'
-import { set } from 'lodash'
-
-import messages from '../i18n/messages'
-import localeService from '../services/locale/locale.service.js'
-import { applyStyleConfig } from '../services/style_setter/style_setter.js'
-import { defaultState, instanceDefaultConfig } from './default_config_state.js'
-
-import { useEmojiStore } from 'src/stores/emoji.js'
-import { useI18nStore } from 'src/stores/i18n.js'
-import { useInstanceStore } from 'src/stores/instance.js'
-import { useInterfaceStore } from 'src/stores/interface.js'
-
-const BACKEND_LANGUAGE_COOKIE_NAME = 'userLanguage'
-const APPEARANCE_SETTINGS_KEYS = new Set([
- 'sidebarColumnWidth',
- 'contentColumnWidth',
- 'notifsColumnWidth',
- 'themeEditorMinWidth',
- 'textSize',
- 'navbarSize',
- 'panelHeaderSize',
- 'forcedRoundness',
- 'emojiSize',
- 'emojiReactionsScale',
-])
-
-/* TODO this is a bit messy.
- * We need to declare settings with their types and also deal with
- * instance-default settings in some way, hopefully try to avoid copy-pasta
- * in general.
- */
-export const multiChoiceProperties = [
- 'postContentType',
- 'subjectLineBehavior',
- 'conversationDisplay', // tree | linear
- 'conversationOtherRepliesButton', // below | inside
- 'mentionLinkDisplay', // short | full_for_remote | full
- 'userPopoverAvatarAction', // close | zoom | open
- 'unsavedPostAction', // save | discard | confirm
-]
-
-// caching the instance default properties
-export const instanceDefaultProperties = Object.keys(instanceDefaultConfig)
-
-const config = {
- state: { ...defaultState },
- getters: {
- defaultConfig() {
- return {
- ...defaultState,
- ...Object.fromEntries(
- instanceDefaultProperties.map((key) => [
- key,
- useInstanceStore().prefsStorage[key],
- ]),
- ),
- }
- },
- mergedConfig(state) {
- const instancePrefs = useInstanceStore().prefsStorage
- const result = Object.fromEntries(
- Object.keys(defaultState).map((key) => [
- key,
- state[key] ?? instancePrefs[key],
- ]),
- )
- return result
- },
- },
- mutations: {
- setOptionTemporarily(state, { name, value }) {
- set(state, name, value)
- applyStyleConfig(state)
- },
- setOption(state, { name, value }) {
- set(state, name, value)
- },
- setHighlight(state, { user, color, type }) {
- const data = this.state.config.highlight[user]
- if (color || type) {
- state.highlight[user] = {
- color: color || data.color,
- type: type || data.type,
- }
- } else {
- delete state.highlight[user]
- }
- },
- },
- actions: {
- loadSettings({ dispatch }, data) {
- const knownKeys = new Set(Object.keys(defaultState))
- const presentKeys = new Set(Object.keys(data))
- const intersection = new Set()
- for (const elem of presentKeys) {
- if (knownKeys.has(elem)) {
- intersection.add(elem)
- }
- }
-
- intersection.forEach((name) =>
- dispatch('setOption', { name, value: data[name] }),
- )
- },
- setHighlight({ commit }, { user, color, type }) {
- commit('setHighlight', { user, color, type })
- },
- setOptionTemporarily({ commit, dispatch, state }, { name, value }) {
- if (useInterfaceStore().temporaryChangesTimeoutId !== null) {
- console.warn("Can't track more than one temporary change")
- return
- }
- const oldValue = state[name]
-
- commit('setOptionTemporarily', { name, value })
-
- const confirm = () => {
- dispatch('setOption', { name, value })
- useInterfaceStore().clearTemporaryChanges()
- }
-
- const revert = () => {
- commit('setOptionTemporarily', { name, value: oldValue })
- useInterfaceStore().clearTemporaryChanges()
- }
-
- useInterfaceStore().setTemporaryChanges({
- confirm,
- revert,
- })
- },
- setThemeV2({ commit, dispatch }, { customTheme, customThemeSource }) {
- commit('setOption', { name: 'theme', value: 'custom' })
- commit('setOption', { name: 'customTheme', value: customTheme })
- commit('setOption', {
- name: 'customThemeSource',
- value: customThemeSource,
- })
- dispatch('setTheme', { themeData: customThemeSource, recompile: true })
- },
- setOption({ commit, dispatch, state }, { name, value }) {
- const exceptions = new Set(['useStreamingApi'])
-
- if (exceptions.has(name)) {
- switch (name) {
- case 'useStreamingApi': {
- const action = value ? 'enableMastoSockets' : 'disableMastoSockets'
-
- dispatch(action)
- .then(() => {
- commit('setOption', { name: 'useStreamingApi', value })
- })
- .catch((e) => {
- console.error('Failed starting MastoAPI Streaming socket', e)
- dispatch('disableMastoSockets')
- dispatch('setOption', { name: 'useStreamingApi', value: false })
- })
- break
- }
- }
- } else {
- commit('setOption', { name, value })
- if (APPEARANCE_SETTINGS_KEYS.has(name)) {
- applyStyleConfig(state)
- }
- if (name.startsWith('theme3hacks')) {
- dispatch('applyTheme', { recompile: true })
- }
- switch (name) {
- case 'theme':
- if (value === 'custom') break
- dispatch('setTheme', {
- themeName: value,
- recompile: true,
- saveData: true,
- })
- break
- case 'themeDebug': {
- dispatch('setTheme', { recompile: true })
- break
- }
- case 'interfaceLanguage':
- messages.setLanguage(useI18nStore().i18n, value)
- useEmojiStore().loadUnicodeEmojiData(value)
- Cookies.set(
- BACKEND_LANGUAGE_COOKIE_NAME,
- localeService.internalToBackendLocaleMulti(value),
- )
- break
- case 'thirdColumnMode':
- useInterfaceStore().setLayoutWidth(undefined)
- break
- }
- }
- },
- },
-}
-
-export default config
diff --git a/src/modules/index.js b/src/modules/index.js
index 15e57f7163..76bdbf7f33 100644
--- a/src/modules/index.js
+++ b/src/modules/index.js
@@ -1,21 +1,19 @@
import adminSettings from './adminSettings.js'
import api from './api.js'
import chats from './chats.js'
-import config from './config.js'
import drafts from './drafts.js'
import notifications from './notifications.js'
import profileConfig from './profileConfig.js'
import statuses from './statuses.js'
import users from './users.js'
export default {
statuses,
notifications,
users,
api,
- config,
profileConfig,
adminSettings,
drafts,
chats,
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Oct 29, 7:31 AM (9 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1797715
Default Alt Text
(9 KB)
Attached To
Mode
rPUFE pleroma-fe-upstream
Attached
Detach File
Event Timeline