setting-sync #175
5 changed files with 18 additions and 8 deletions
|
@ -61,7 +61,6 @@
|
||||||
<EditStatusModal v-if="editingAvailable" />
|
<EditStatusModal v-if="editingAvailable" />
|
||||||
<StatusHistoryModal v-if="editingAvailable" />
|
<StatusHistoryModal v-if="editingAvailable" />
|
||||||
<SettingsModal />
|
<SettingsModal />
|
||||||
<UpdateNotification />
|
|
||||||
<GlobalNoticeList />
|
<GlobalNoticeList />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -398,8 +398,6 @@ const afterStoreSetup = async ({ store, i18n }) => {
|
||||||
store.dispatch('startFetchingAnnouncements')
|
store.dispatch('startFetchingAnnouncements')
|
||||||
getTOS({ store })
|
getTOS({ store })
|
||||||
getStickers({ store })
|
getStickers({ store })
|
||||||
store.dispatch('getSupportedTranslationlanguages')
|
|
||||||
store.dispatch('getSettingsProfile')
|
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHistory(),
|
||||||
|
|
|
@ -892,6 +892,11 @@
|
||||||
"word_filter": "Word filter",
|
"word_filter": "Word filter",
|
||||||
"wordfilter": "Wordfilter"
|
"wordfilter": "Wordfilter"
|
||||||
},
|
},
|
||||||
|
"settings_profile": {
|
||||||
|
"synchronizing": "Synchronizing setting profile \"{profile}\"...",
|
||||||
|
"synchronized": "Synchronized settings!",
|
||||||
|
"synchronization_error": "Could not synchronize settings: {err}"
|
||||||
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"ancestor_follow": "See {numReplies} other reply under this post | See {numReplies} other replies under this post",
|
"ancestor_follow": "See {numReplies} other reply under this post | See {numReplies} other replies under this post",
|
||||||
"ancestor_follow_with_icon": "{icon} {text}",
|
"ancestor_follow_with_icon": "{icon} {text}",
|
||||||
|
|
|
@ -165,8 +165,9 @@ const config = {
|
||||||
syncSettings: (store) => {
|
syncSettings: (store) => {
|
||||||
store.commit('setOption', { name: 'profileVersion', value: store.state.profileVersion + 1 })
|
store.commit('setOption', { name: 'profileVersion', value: store.state.profileVersion + 1 })
|
||||||
const notice = {
|
const notice = {
|
||||||
level: 'warning',
|
level: 'info',
|
||||||
messageKey: 'settingsProfile.synchronizing',
|
messageKey: 'settings_profile.synchronizing',
|
||||||
|
messageArgs: { profile: store.state.profile },
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
}
|
}
|
||||||
store.dispatch('pushGlobalNotice', notice)
|
store.dispatch('pushGlobalNotice', notice)
|
||||||
|
@ -176,14 +177,15 @@ const config = {
|
||||||
store.dispatch('removeGlobalNotice', notice)
|
store.dispatch('removeGlobalNotice', notice)
|
||||||
store.dispatch('pushGlobalNotice', {
|
store.dispatch('pushGlobalNotice', {
|
||||||
level: 'success',
|
level: 'success',
|
||||||
messageKey: 'settingsProfile.synchronized',
|
messageKey: 'settings_profile.synchronized',
|
||||||
|
messageArgs: { profile: store.state.profile },
|
||||||
timeout: 2000
|
timeout: 2000
|
||||||
})
|
})
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
store.dispatch('removeGlobalNotice', notice)
|
store.dispatch('removeGlobalNotice', notice)
|
||||||
store.dispatch('pushGlobalNotice', {
|
store.dispatch('pushGlobalNotice', {
|
||||||
level: 'error',
|
level: 'error',
|
||||||
messageKey: 'settingsProfile.synchronizationError',
|
messageKey: 'settings_profile.synchronization_error',
|
||||||
messageArgs: { error: err.message },
|
messageArgs: { error: err.message },
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
})
|
})
|
||||||
|
@ -231,12 +233,16 @@ const config = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getSettingsProfile (store) {
|
getSettingsProfile (store) {
|
||||||
|
console.log('getSettingsProfile')
|
||||||
const profile = store.state.profile
|
const profile = store.state.profile
|
||||||
store.rootState.api.backendInteractor.getSettingsProfile({ store, profileName: profile })
|
store.rootState.api.backendInteractor.getSettingsProfile({ store, profileName: profile })
|
||||||
.then(({ settings, version }) => {
|
.then(({ settings, version }) => {
|
||||||
|
console.log('found settings version', version)
|
||||||
if (version > store.state.profileVersion) {
|
if (version > store.state.profileVersion) {
|
||||||
store.commit('setOption', { name: 'profileVersion', value: version })
|
store.commit('setOption', { name: 'profileVersion', value: version })
|
||||||
store.dispatch('loadSettings', settings)
|
store.dispatch('loadSettings', settings)
|
||||||
|
} else {
|
||||||
|
console.log('settings are up to date')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -245,7 +251,7 @@ const config = {
|
||||||
// create profile
|
// create profile
|
||||||
store.dispatch('pushGlobalNotice', {
|
store.dispatch('pushGlobalNotice', {
|
||||||
level: 'warning',
|
level: 'warning',
|
||||||
messageKey: 'settingsProfile.creating',
|
messageKey: 'settings_profile.creating',
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
})
|
})
|
||||||
store.dispatch('syncSettings')
|
store.dispatch('syncSettings')
|
||||||
|
|
|
@ -581,6 +581,8 @@ const users = {
|
||||||
|
|
||||||
store.dispatch('setLayoutWidth', windowWidth())
|
store.dispatch('setLayoutWidth', windowWidth())
|
||||||
store.dispatch('setLayoutHeight', windowHeight())
|
store.dispatch('setLayoutHeight', windowHeight())
|
||||||
|
store.dispatch('getSupportedTranslationlanguages')
|
||||||
|
store.dispatch('getSettingsProfile')
|
||||||
|
|
||||||
// Fetch our friends
|
// Fetch our friends
|
||||||
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
|
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
|
||||||
|
|
Loading…
Reference in a new issue