chore: refactor different namespace check to use a computed function

This commit is contained in:
kolaente 2021-10-31 15:18:16 +01:00
parent d87550fbd2
commit fed3014c7b
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -43,7 +43,7 @@
v-if="props.option.listId !== listId" v-if="props.option.listId !== listId"
> >
<span <span
v-if="$store.getters['namespaces/getListAndNamespaceById'](props.option.listId) !== null && $store.getters['namespaces/getListAndNamespaceById'](props.option.listId).namespace.id !== namespace.id" v-if="namespaceIsDifferent(props.option.listId)"
v-tooltip="$t('task.relation.differentNamespace')"> v-tooltip="$t('task.relation.differentNamespace')">
{{ {{
$store.getters['namespaces/getListAndNamespaceById'](props.option.listId).namespace.title $store.getters['namespaces/getListAndNamespaceById'](props.option.listId).namespace.title
@ -93,7 +93,7 @@
v-if="t.listId !== listId" v-if="t.listId !== listId"
> >
<span <span
v-if="$store.getters['namespaces/getListAndNamespaceById'](t.listId) !== null && $store.getters['namespaces/getListAndNamespaceById'](t.listId).namespace.id !== namespace.id" v-if="namespaceIsDifferent(t.listId)"
v-tooltip="$t('task.relation.differentNamespace')"> v-tooltip="$t('task.relation.differentNamespace')">
{{ {{
$store.getters['namespaces/getListAndNamespaceById'](t.listId).namespace.title $store.getters['namespaces/getListAndNamespaceById'](t.listId).namespace.title
@ -206,6 +206,12 @@ export default {
namespace() { namespace() {
return this.$store.getters['namespaces/getListAndNamespaceById'](this.listId)?.namespace return this.$store.getters['namespaces/getListAndNamespaceById'](this.listId)?.namespace
}, },
namespaceIsDifferent() {
return listId => {
const namespace = this.$store.getters['namespaces/getListAndNamespaceById'](listId)
return namespace !== null && namespace.id !== this.namespace.id
}
},
}, },
methods: { methods: {
async findTasks(query) { async findTasks(query) {