fix: missed porting these getters and commits

This commit is contained in:
Dominik Pschenitschni 2022-09-23 13:29:10 +02:00
parent 62ed7c5964
commit 95ad245b59
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
2 changed files with 13 additions and 10 deletions

View file

@ -71,6 +71,8 @@ import {parseTaskText, PrefixMode} from '@/modules/parseTaskText'
import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode' import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode'
import {PREFIXES} from '@/modules/parseTaskText' import {PREFIXES} from '@/modules/parseTaskText'
import {useListStore} from '@/stores/lists' import {useListStore} from '@/stores/lists'
import {useNamespaceStore} from '@/stores/namespaces'
import {useLabelStore} from '@/stores/labels'
const TYPE_LIST = 'list' const TYPE_LIST = 'list'
const TYPE_TASK = 'task' const TYPE_TASK = 'task'
@ -139,7 +141,7 @@ export default defineComponent({
} }
if (typeof ncache[l.namespaceId] === 'undefined') { if (typeof ncache[l.namespaceId] === 'undefined') {
ncache[l.namespaceId] = this.$store.getters['namespaces/getNamespaceById'](l.namespaceId) ncache[l.namespaceId] = useNamespaceStore().getNamespaceById(l.namespaceId)
} }
return !ncache[l.namespaceId].isArchived return !ncache[l.namespaceId].isArchived
@ -206,7 +208,7 @@ export default defineComponent({
case CMD_NEW_TASK: case CMD_NEW_TASK:
return this.$t('quickActions.createTask', {title: this.currentList.title}) return this.$t('quickActions.createTask', {title: this.currentList.title})
case CMD_NEW_LIST: case CMD_NEW_LIST:
namespace = this.$store.getters['namespaces/getNamespaceById'](this.currentList.namespaceId) namespace = useNamespaceStore().getNamespaceById(this.currentList.namespaceId)
return this.$t('quickActions.createList', {title: namespace.title}) return this.$t('quickActions.createList', {title: namespace.title})
} }
} }
@ -309,7 +311,7 @@ export default defineComponent({
} }
if (labels.length > 0) { if (labels.length > 0) {
const labelIds = this.$store.getters['labels/getLabelsByExactTitles'](labels).map(l => l.id) const labelIds = useLabelStore().getLabelsByExactTitles(labels).map(l => l.id)
if (labelIds.length > 0) { if (labelIds.length > 0) {
params.filter_by.push('labels') params.filter_by.push('labels')
params.filter_value.push(labelIds.join()) params.filter_value.push(labelIds.join())
@ -436,7 +438,7 @@ export default defineComponent({
async newNamespace() { async newNamespace() {
const newNamespace = new NamespaceModel({title: this.query}) const newNamespace = new NamespaceModel({title: this.query})
await this.$store.dispatch('namespaces/createNamespace', newNamespace) await useNamespaceStore().createNamespace(newNamespace)
this.$message.success({message: this.$t('namespace.create.success')}) this.$message.success({message: this.$t('namespace.create.success')})
this.closeQuickActions() this.closeQuickActions()
}, },

View file

@ -94,8 +94,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import {defineComponent} from 'vue' export default { name: 'list-setting-background' }
export default defineComponent({ name: 'list-setting-background' })
</script> </script>
<script setup lang="ts"> <script setup lang="ts">
@ -106,6 +105,7 @@ import {useRoute, useRouter} from 'vue-router'
import debounce from 'lodash.debounce' import debounce from 'lodash.debounce'
import BaseButton from '@/components/base/BaseButton.vue' import BaseButton from '@/components/base/BaseButton.vue'
import {useListStore} from '@/stores/lists' import {useListStore} from '@/stores/lists'
import {useNamespaceStore} from '@/stores/namespaces'
import BackgroundUnsplashService from '@/services/backgroundUnsplash' import BackgroundUnsplashService from '@/services/backgroundUnsplash'
import BackgroundUploadService from '@/services/backgroundUpload' import BackgroundUploadService from '@/services/backgroundUpload'
@ -117,7 +117,7 @@ import {useTitle} from '@/composables/useTitle'
import {CURRENT_LIST} from '@/store/mutation-types' import {CURRENT_LIST} from '@/store/mutation-types'
import CreateEdit from '@/components/misc/create-edit.vue' import CreateEdit from '@/components/misc/create-edit.vue'
import { success } from '@/message' import {success} from '@/message'
const SEARCH_DEBOUNCE = 300 const SEARCH_DEBOUNCE = 300
@ -143,6 +143,7 @@ const debounceNewBackgroundSearch = debounce(newBackgroundSearch, SEARCH_DEBOUNC
const backgroundUploadService = ref(new BackgroundUploadService()) const backgroundUploadService = ref(new BackgroundUploadService())
const listService = ref(new ListService()) const listService = ref(new ListService())
const listStore = useListStore() const listStore = useListStore()
const namespaceStore = useNamespaceStore()
const unsplashBackgroundEnabled = computed(() => store.state.config.enabledBackgroundProviders.includes('unsplash')) const unsplashBackgroundEnabled = computed(() => store.state.config.enabledBackgroundProviders.includes('unsplash'))
const uploadBackgroundEnabled = computed(() => store.state.config.enabledBackgroundProviders.includes('upload')) const uploadBackgroundEnabled = computed(() => store.state.config.enabledBackgroundProviders.includes('upload'))
@ -187,7 +188,7 @@ async function setBackground(backgroundId: string) {
const list = await backgroundService.update({id: backgroundId, listId: route.params.listId}) const list = await backgroundService.update({id: backgroundId, listId: route.params.listId})
await store.dispatch(CURRENT_LIST, {list, forceUpdate: true}) await store.dispatch(CURRENT_LIST, {list, forceUpdate: true})
store.commit('namespaces/setListInNamespaceById', list) namespaceStore.setListInNamespaceById(list)
listStore.setList(list) listStore.setList(list)
success({message: t('list.background.success')}) success({message: t('list.background.success')})
} }
@ -200,7 +201,7 @@ async function uploadBackground() {
const list = await backgroundUploadService.value.create(route.params.listId, backgroundUploadInput.value?.files[0]) const list = await backgroundUploadService.value.create(route.params.listId, backgroundUploadInput.value?.files[0])
await store.dispatch(CURRENT_LIST, {list, forceUpdate: true}) await store.dispatch(CURRENT_LIST, {list, forceUpdate: true})
store.commit('namespaces/setListInNamespaceById', list) namespaceStore.setListInNamespaceById(list)
listStore.setList(list) listStore.setList(list)
success({message: t('list.background.success')}) success({message: t('list.background.success')})
} }
@ -208,7 +209,7 @@ async function uploadBackground() {
async function removeBackground() { async function removeBackground() {
const list = await listService.value.removeBackground(currentList.value) const list = await listService.value.removeBackground(currentList.value)
await store.dispatch(CURRENT_LIST, {list, forceUpdate: true}) await store.dispatch(CURRENT_LIST, {list, forceUpdate: true})
store.commit('namespaces/setListInNamespaceById', list) namespaceStore.setListInNamespaceById(list)
listStore.setList(list) listStore.setList(list)
success({message: t('list.background.removeSuccess')}) success({message: t('list.background.removeSuccess')})
router.back() router.back()