logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: cfdd885e041d69262e5a0aaaac8de1f39a926484
parent: a49f6dbf65bb9b7d8450853cb5c868fac2e37fe0
Author: Shpuld Shpludson <shp@cock.li>
Date:   Wed, 20 Feb 2019 14:42:27 +0000

Merge branch 'issue-371-user-setting-notification' into 'develop'

#371: show notification when user setting's saved

Closes #371

See merge request pleroma/pleroma-fe!598

Diffstat:

Msrc/components/user_settings/user_settings.js3+++
Msrc/components/user_settings/user_settings.vue15++++++++++++++-
Msrc/lib/persisted_state.js4++--
3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js @@ -60,6 +60,9 @@ const UserSettings = { private: { selected: this.newDefaultScope === 'private' }, direct: { selected: this.newDefaultScope === 'direct' } } + }, + currentSaveStateNotice () { + return this.$store.state.interface.settings.currentSaveStateNotice } }, methods: { diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue @@ -1,7 +1,20 @@ <template> <div class="settings panel panel-default"> <div class="panel-heading"> - {{$t('settings.user_settings')}} + <div class="title"> + {{$t('settings.user_settings')}} + </div> + <transition name="fade"> + <template v-if="currentSaveStateNotice"> + <div @click.prevent class="alert error" v-if="currentSaveStateNotice.error"> + {{ $t('settings.saving_err') }} + </div> + + <div @click.prevent class="alert transparent" v-if="!currentSaveStateNotice.error"> + {{ $t('settings.saving_ok') }} + </div> + </template> + </transition> </div> <div class="panel-body profile-edit"> <tab-switcher> diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js @@ -84,12 +84,12 @@ export default function createPersistedState ({ setState(key, reducer(state, paths), storage) .then(success => { if (typeof success !== 'undefined') { - if (mutation.type === 'setOption') { + if (mutation.type === 'setOption' || mutation.type === 'setCurrentUser') { store.dispatch('settingsSaved', { success }) } } }, error => { - if (mutation.type === 'setOption') { + if (mutation.type === 'setOption' || mutation.type === 'setCurrentUser') { store.dispatch('settingsSaved', { error }) } })