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
1 changed files with 8 additions and 2 deletions

View File

@ -43,7 +43,7 @@
v-if="props.option.listId !== listId"
>
<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')">
{{
$store.getters['namespaces/getListAndNamespaceById'](props.option.listId).namespace.title
@ -93,7 +93,7 @@
v-if="t.listId !== listId"
>
<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')">
{{
$store.getters['namespaces/getListAndNamespaceById'](t.listId).namespace.title
@ -206,6 +206,12 @@ export default {
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: {
async findTasks(query) {