From 543dae2f30c795f33f6846b9dfc3d87fa7d92719 Mon Sep 17 00:00:00 2001 From: konrad Date: Mon, 13 Dec 2021 22:20:45 +0000 Subject: [PATCH] fix: saving default list (#1143) Co-authored-by: kolaente Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1143 Reviewed-by: Dominik Pschenitschni Co-authored-by: konrad Co-committed-by: konrad --- src/components/input/multiselect.vue | 4 +- src/components/tasks/partials/listSearch.vue | 84 +++++++++----------- src/views/tasks/TaskDetailView.vue | 2 +- src/views/user/settings/General.vue | 30 ++++--- 4 files changed, 62 insertions(+), 58 deletions(-) diff --git a/src/components/input/multiselect.vue b/src/components/input/multiselect.vue index 87e953de..a39d5022 100644 --- a/src/components/input/multiselect.vue +++ b/src/components/input/multiselect.vue @@ -457,7 +457,7 @@ export default { text-transform: none; font-family: $family-sans-serif; font-weight: normal; - padding: .5rem 0; + padding: .5rem; border: none; cursor: pointer; @@ -477,7 +477,7 @@ export default { font-size: .75rem; color: transparent; transition: color $transition; - padding: 0 .5rem; + padding-left: .5rem; } &:focus, &:hover { diff --git a/src/components/tasks/partials/listSearch.vue b/src/components/tasks/partials/listSearch.vue index 9dabce80..f5011741 100644 --- a/src/components/tasks/partials/listSearch.vue +++ b/src/components/tasks/partials/listSearch.vue @@ -16,60 +16,54 @@ - \ No newline at end of file diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue index 861574d1..988b154a 100644 --- a/src/views/tasks/TaskDetailView.vue +++ b/src/views/tasks/TaskDetailView.vue @@ -238,7 +238,7 @@
- +
diff --git a/src/views/user/settings/General.vue b/src/views/user/settings/General.vue index 347d1cc2..2d808459 100644 --- a/src/views/user/settings/General.vue +++ b/src/views/user/settings/General.vue @@ -131,8 +131,10 @@ import {playPop} from '@/helpers/playPop' import {useColorScheme} from '@/composables/useColorScheme' import {success} from '@/message' +const DEFAULT_LIST_ID = 0 + function useColorSchemeSetting() { - const { t } = useI18n() + const {t} = useI18n() const colorSchemeSettings = computed(() => ({ light: t('user.settings.appearance.colorScheme.light'), auto: t('user.settings.appearance.colorScheme.system'), @@ -141,9 +143,11 @@ function useColorSchemeSetting() { const {store} = useColorScheme() watch(store, (schemeId) => { - success({message: t('user.settings.appearance.setSuccess', { - colorScheme: colorSchemeSettings.value[schemeId], - })}) + success({ + message: t('user.settings.appearance.setSuccess', { + colorScheme: colorSchemeSettings.value[schemeId], + }), + }) }) return { @@ -178,8 +182,13 @@ export default { .map(l => ({code: l[0], title: l[1]})) .sort((a, b) => a.title.localeCompare(b.title)) }, - defaultList() { - return this.$store.getters['lists/getListById'](this.settings.defaultListId) + defaultList: { + get() { + return this.$store.getters['lists/getListById'](this.settings.defaultListId) + }, + set(l) { + this.settings.defaultListId = l ? l.id : DEFAULT_LIST_ID + }, }, }, @@ -204,12 +213,13 @@ export default { localStorage.setItem(playSoundWhenDoneKey, this.playSoundWhenDone) saveLanguage(this.language) setQuickAddMagicMode(this.quickAddMagicMode) - this.settings.defaultListId = this.defaultList ? this.defaultList.id : 0 - await this.userSettingsService.update(this.settings) - this.$store.commit('auth/setUserSettings', { + const settings = { ...this.settings, - }) + } + + await this.userSettingsService.update(settings) + this.$store.commit('auth/setUserSettings', settings) this.$message.success({message: this.$t('user.settings.general.savedSuccess')}) }, },