fix invalid option copy
This commit is contained in:
parent
095abb2914
commit
912aa228d1
9 changed files with 42 additions and 58 deletions
|
|
@ -162,17 +162,17 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => {
|
|||
config = Object.assign({}, staticConfig, apiConfig)
|
||||
}
|
||||
|
||||
const copyInstanceOption = (path) => {
|
||||
if (typeof config[name] !== 'undefined') {
|
||||
useInstanceStore().set({ path, value: config[name] })
|
||||
const copyInstanceOption = ({ source, destination }) => {
|
||||
if (typeof config[source] !== 'undefined') {
|
||||
useInstanceStore().set({ path: destination, value: config[source] })
|
||||
}
|
||||
}
|
||||
|
||||
Object.keys(staticOrApiConfigDefault)
|
||||
.map((k) => `instanceIdentity.${k}`)
|
||||
.map((k) => ({ source: k, destination: `instanceIdentity.${k}`}))
|
||||
.forEach(copyInstanceOption)
|
||||
Object.keys(instanceDefaultConfig)
|
||||
.map((k) => `prefsStorage.${k}`)
|
||||
.map((k) => ({ source: k, destination: `prefsStorage.${k}`}))
|
||||
.forEach(copyInstanceOption)
|
||||
|
||||
useAuthFlowStore().setInitialStrategy(config.loginMethod)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export default (store) => {
|
|||
if (store.state.users.currentUser) {
|
||||
next()
|
||||
} else {
|
||||
next(useInstanceStore().redirectRootNoLogin || '/main/all')
|
||||
next(useInstanceStore().instanceIdentity.redirectRootNoLogin || '/main/all')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,8 +49,8 @@ export default (store) => {
|
|||
redirect: () => {
|
||||
return (
|
||||
(store.state.users.currentUser
|
||||
? useInstanceStore().redirectRootLogin
|
||||
: useInstanceStore().redirectRootNoLogin) || '/main/all'
|
||||
? useInstanceStore().instanceIdentity.redirectRootLogin
|
||||
: useInstanceStore().instanceIdentity.redirectRootNoLogin) || '/main/all'
|
||||
)
|
||||
},
|
||||
},
|
||||
|
|
@ -201,7 +201,7 @@ export default (store) => {
|
|||
},
|
||||
]
|
||||
|
||||
if (useInstanceStore().pleromaChatMessagesAvailable) {
|
||||
if (useInstanceStore().featureSet.pleromaChatMessagesAvailable) {
|
||||
routes = routes.concat([
|
||||
{
|
||||
name: 'chat',
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ const BlockCard = {
|
|||
new Date(this.user.mute_expires_at).toLocaleString(),
|
||||
])
|
||||
},
|
||||
...mapState({
|
||||
blockExpirationSupported: (store) => store.blockExpiration,
|
||||
...mapState(useInstanceStore, {
|
||||
blockExpirationSupported: (store) => store.featureSet.blockExpiration,
|
||||
}),
|
||||
},
|
||||
components: {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import SearchBar from 'components/search_bar/search_bar.vue'
|
||||
import { mapState } from 'pinia'
|
||||
import { mapState, mapActions } from 'pinia'
|
||||
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
|
|
@ -88,7 +88,7 @@ export default {
|
|||
logo: (store) => store.instanceIdentity.logo,
|
||||
logoLeft: (store) => store.instanceIdentity.logoLeft,
|
||||
logoMargin: (store) => store.instanceIdentity.logoMargin,
|
||||
name: (store) => store.instanceIdentity.name,
|
||||
sitename: (store) => store.instanceIdentity.name,
|
||||
hideSitename: (store) => store.instanceIdentity.hideSitename,
|
||||
}),
|
||||
currentUser() {
|
||||
|
|
@ -123,11 +123,6 @@ export default {
|
|||
onSearchBarToggled(hidden) {
|
||||
this.searchBarHidden = hidden
|
||||
},
|
||||
openSettingsModal() {
|
||||
useInterfaceStore().openSettingsModal('user')
|
||||
},
|
||||
openAdminModal() {
|
||||
useInterfaceStore().openSettingsModal('admin')
|
||||
},
|
||||
...mapActions(useInterfaceStore, ['openSettingsModal'])
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
<button
|
||||
class="button-unstyled nav-icon"
|
||||
:title="$t('nav.preferences')"
|
||||
@click.stop="openSettingsModal"
|
||||
@click.stop="openSettingsModal('user')"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
class="button-unstyled nav-icon"
|
||||
target="_blank"
|
||||
:title="$t('nav.administration')"
|
||||
@click.stop="openAdminModal"
|
||||
@click.stop="openSettingsModal('admin')"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { mapState as mapPiniaState } from 'pinia'
|
||||
import { mapGetters, mapState } from 'vuex'
|
||||
import { mapState, mapActions } from 'pinia'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
import { USERNAME_ROUTES } from 'src/components/navigation/navigation.js'
|
||||
import { useAnnouncementsStore } from 'src/stores/announcements'
|
||||
|
|
@ -75,18 +75,6 @@ const SideDrawer = {
|
|||
unseenNotificationsCount() {
|
||||
return this.unseenNotifications.length
|
||||
},
|
||||
suggestionsEnabled() {
|
||||
return useInstanceStore().suggestionsEnabled
|
||||
},
|
||||
logo() {
|
||||
return useInstanceStore().logo
|
||||
},
|
||||
hideSitename() {
|
||||
return useInstanceStore().hideSitename
|
||||
},
|
||||
sitename() {
|
||||
return useInstanceStore().name
|
||||
},
|
||||
followRequestCount() {
|
||||
return this.$store.state.api.followRequests.length
|
||||
},
|
||||
|
|
@ -108,13 +96,17 @@ const SideDrawer = {
|
|||
return { name }
|
||||
}
|
||||
},
|
||||
...mapPiniaState(useAnnouncementsStore, {
|
||||
supportsAnnouncements: (store) => store.supportsAnnouncements,
|
||||
unreadAnnouncementCount: 'unreadAnnouncementCount',
|
||||
}),
|
||||
...mapState({
|
||||
pleromaChatMessagesAvailable: (state) =>
|
||||
useInstanceStore().pleromaChatMessagesAvailable,
|
||||
...mapState(useAnnouncementsStore, [
|
||||
'supportsAnnouncements',
|
||||
'unreadAnnouncementCount',
|
||||
]),
|
||||
...mapState(useInstanceStore, ['private', 'federating']),
|
||||
...mapState(useInstanceStore, {
|
||||
logo: (store) => store.instanceIdentity.logo,
|
||||
sitename: (store) => store.instanceIdentity.name,
|
||||
hideSitename: (store) => store.instanceIdentity.hideSitename,
|
||||
pleromaChatMessagesAvailable: (store) => store.featureSet.pleromaChatMessagesAvailable,
|
||||
suggestionsEnabled: (store) => store.featureSet.suggestionsEnabled,
|
||||
}),
|
||||
...mapGetters(['unreadChatCount', 'draftCount']),
|
||||
},
|
||||
|
|
@ -132,12 +124,7 @@ const SideDrawer = {
|
|||
touchMove(e) {
|
||||
GestureService.updateSwipe(e, this.closeGesture)
|
||||
},
|
||||
openSettingsModal() {
|
||||
useInterfaceStore().openSettingsModal('user')
|
||||
},
|
||||
openAdminModal() {
|
||||
useInterfaceStore().openSettingsModal('admin')
|
||||
},
|
||||
...mapActions(useInterfaceStore, ['openSettingsModal'])
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@
|
|||
<li @click="toggleDrawer">
|
||||
<button
|
||||
class="menu-item"
|
||||
@click="openSettingsModal"
|
||||
@click="openSettingsModal('user')"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
|
|
@ -225,7 +225,7 @@
|
|||
>
|
||||
<button
|
||||
class="menu-item"
|
||||
@click.stop="openAdminModal"
|
||||
@click.stop="openSettingsModal('admin')"
|
||||
>
|
||||
<FAIcon
|
||||
fixed-width
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import UserTimedFilterModal from 'src/components/user_timed_filter_modal/user_ti
|
|||
import { propsToNative } from 'src/services/attributes_helper/attributes_helper.service.js'
|
||||
import localeService from 'src/services/locale/locale.service.js'
|
||||
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
|
||||
import { useEmojiStore } from 'src/stores/emoji.js'
|
||||
import { useInstanceStore } from 'src/stores/instance.js'
|
||||
import { usePostStatusStore } from 'src/stores/post_status'
|
||||
import { useInterfaceStore } from '../../stores/interface'
|
||||
|
|
@ -210,7 +211,7 @@ export default {
|
|||
return Math.round(this.user.statuses_count / days)
|
||||
},
|
||||
emoji() {
|
||||
return useInstanceStore().customEmoji.map((e) => ({
|
||||
return useEmojiStore().customEmoji.map((e) => ({
|
||||
shortcode: e.displayText,
|
||||
static_url: e.imageUrl,
|
||||
url: e.imageUrl,
|
||||
|
|
@ -358,7 +359,7 @@ export default {
|
|||
)
|
||||
},
|
||||
fieldsLimits() {
|
||||
return useInstanceStore().fieldsLimits
|
||||
return useInstanceStore().limits.fieldsLimits
|
||||
},
|
||||
maxFields() {
|
||||
return this.fieldsLimits ? this.fieldsLimits.maxFields : 0
|
||||
|
|
@ -367,7 +368,7 @@ export default {
|
|||
return suggestor({
|
||||
emoji: [
|
||||
...this.$store.getters.standardEmojiList,
|
||||
...useInstanceStore().customEmoji,
|
||||
...useEmojiStore().customEmoji,
|
||||
],
|
||||
store: this.$store,
|
||||
})
|
||||
|
|
@ -376,7 +377,7 @@ export default {
|
|||
return suggestor({
|
||||
emoji: [
|
||||
...this.$store.getters.standardEmojiList,
|
||||
...useInstanceStore().customEmoji,
|
||||
...useEmojiStore().customEmoji,
|
||||
],
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -51,17 +51,18 @@ const config = {
|
|||
...Object.fromEntries(
|
||||
instanceDefaultProperties.map((key) => [
|
||||
key,
|
||||
useInstanceStore()[key],
|
||||
useInstanceStore().prefsStorage[key],
|
||||
]),
|
||||
),
|
||||
}
|
||||
},
|
||||
mergedConfig(state) {
|
||||
const instancePrefs = useInstanceStore().prefsStorage
|
||||
console.log(state)
|
||||
const result = Object.fromEntries(
|
||||
Object.entries(defaultState).map(([k, v]) => [
|
||||
k,
|
||||
v ?? instancePrefs[k],
|
||||
Object.keys(defaultState).map((key) => [
|
||||
key,
|
||||
state[key] ?? instancePrefs[key],
|
||||
]),
|
||||
)
|
||||
return result
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue