setting-sync #175

Merged
floatingghost merged 6 commits from setting-sync into develop 2022-10-06 15:59:17 +00:00
5 changed files with 18 additions and 8 deletions
Showing only changes of commit 99b9085707 - Show all commits

View file

@ -61,7 +61,6 @@
<EditStatusModal v-if="editingAvailable" />
<StatusHistoryModal v-if="editingAvailable" />
<SettingsModal />
<UpdateNotification />
<GlobalNoticeList />
</div>
</template>

View file

@ -398,8 +398,6 @@ const afterStoreSetup = async ({ store, i18n }) => {
store.dispatch('startFetchingAnnouncements')
getTOS({ store })
getStickers({ store })
store.dispatch('getSupportedTranslationlanguages')
store.dispatch('getSettingsProfile')
const router = createRouter({
history: createWebHistory(),

View file

@ -892,6 +892,11 @@
"word_filter": "Word filter",
"wordfilter": "Wordfilter"
},
"settings_profile": {
"synchronizing": "Synchronizing setting profile \"{profile}\"...",
"synchronized": "Synchronized settings!",
"synchronization_error": "Could not synchronize settings: {err}"
},
"status": {
"ancestor_follow": "See {numReplies} other reply under this post | See {numReplies} other replies under this post",
"ancestor_follow_with_icon": "{icon} {text}",

View file

@ -165,8 +165,9 @@ const config = {
syncSettings: (store) => {
store.commit('setOption', { name: 'profileVersion', value: store.state.profileVersion + 1 })
const notice = {
level: 'warning',
messageKey: 'settingsProfile.synchronizing',
level: 'info',
messageKey: 'settings_profile.synchronizing',
messageArgs: { profile: store.state.profile },
timeout: 5000
}
store.dispatch('pushGlobalNotice', notice)
@ -176,14 +177,15 @@ const config = {
store.dispatch('removeGlobalNotice', notice)
store.dispatch('pushGlobalNotice', {
level: 'success',
messageKey: 'settingsProfile.synchronized',
messageKey: 'settings_profile.synchronized',
messageArgs: { profile: store.state.profile },
timeout: 2000
})
}).catch((err) => {
store.dispatch('removeGlobalNotice', notice)
store.dispatch('pushGlobalNotice', {
level: 'error',
messageKey: 'settingsProfile.synchronizationError',
messageKey: 'settings_profile.synchronization_error',
messageArgs: { error: err.message },
timeout: 5000
})
@ -231,12 +233,16 @@ const config = {
}
},
getSettingsProfile (store) {
console.log('getSettingsProfile')
const profile = store.state.profile
store.rootState.api.backendInteractor.getSettingsProfile({ store, profileName: profile })
.then(({ settings, version }) => {
console.log('found settings version', version)
if (version > store.state.profileVersion) {
store.commit('setOption', { name: 'profileVersion', value: version })
store.dispatch('loadSettings', settings)
} else {
console.log('settings are up to date')
}
})
.catch((err) => {
@ -245,7 +251,7 @@ const config = {
// create profile
store.dispatch('pushGlobalNotice', {
level: 'warning',
messageKey: 'settingsProfile.creating',
messageKey: 'settings_profile.creating',
timeout: 5000
})
store.dispatch('syncSettings')

View file

@ -581,6 +581,8 @@ const users = {
store.dispatch('setLayoutWidth', windowWidth())
store.dispatch('setLayoutHeight', windowHeight())
store.dispatch('getSupportedTranslationlanguages')
store.dispatch('getSettingsProfile')
// Fetch our friends
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })