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