diff --git a/src/views/list/settings/share.vue b/src/views/list/settings/share.vue index ec78b4725..a91626f77 100644 --- a/src/views/list/settings/share.vue +++ b/src/views/list/settings/share.vue @@ -34,6 +34,8 @@ import {useTitle} from '@vueuse/core' import ListService from '@/services/list' import ListModel from '@/models/list' +import type {IList} from '@/modelTypes/IList' +import {RIGHTS} from '@/constants/rights' import CreateEdit from '@/components/misc/create-edit.vue' import LinkSharing from '@/components/sharing/linkSharing.vue' @@ -45,7 +47,7 @@ import {useAuthStore} from '@/stores/auth' const {t} = useI18n({useScope: 'global'}) -const list = ref() +const list = ref() const title = computed(() => list.value?.title ? t('list.share.title', {list: list.value.title}) : '', @@ -56,7 +58,7 @@ const authStore = useAuthStore() const configStore = useConfigStore() const linkSharingEnabled = computed(() => configStore.linkSharingEnabled) -const userIsAdmin = computed(() => 'owner' in list.value && list.value.owner.id === authStore.info.id) +const userIsAdmin = computed(() => list?.value?.maxRight === RIGHTS.ADMIN) async function loadList(listId: number) { const listService = new ListService() diff --git a/src/views/namespaces/settings/share.vue b/src/views/namespaces/settings/share.vue index 6bf39a9be..6600ffff4 100644 --- a/src/views/namespaces/settings/share.vue +++ b/src/views/namespaces/settings/share.vue @@ -31,12 +31,13 @@ import {useI18n} from 'vue-i18n' import NamespaceService from '@/services/namespace' import NamespaceModel from '@/models/namespace' +import type {INamespace} from '@/modelTypes/INamespace' +import {RIGHTS} from '@/constants/rights' import CreateEdit from '@/components/misc/create-edit.vue' import manageSharing from '@/components/sharing/userTeam.vue' import {useTitle} from '@/composables/useTitle' import {useAuthStore} from '@/stores/auth' -import type {INamespace} from '@/modelTypes/INamespace' const {t} = useI18n({useScope: 'global'}) @@ -49,7 +50,7 @@ const title = computed(() => namespace.value?.title useTitle(title) const authStore = useAuthStore() -const userIsAdmin = computed(() => 'owner' in namespace.value && namespace.value.owner.id === authStore.info.id) +const userIsAdmin = computed(() => namespace?.value?.maxRight === RIGHTS.ADMIN) async function loadNamespace(namespaceId: number) { if (!namespaceId) return