mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix users-invite component's incorrect null check (#18583)
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
This commit is contained in:
5
.changeset/orange-trainers-film.md
Normal file
5
.changeset/orange-trainers-film.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@directus/app": patch
|
||||
---
|
||||
|
||||
Fix users-invite component's incorrect null check
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<v-list nav>
|
||||
<v-list-item to="/users" exact :active="currentRole === null">
|
||||
<v-list-item to="/users" exact :active="!currentRole">
|
||||
<v-list-item-icon><v-icon name="folder_shared" /></v-list-item-icon>
|
||||
<v-list-item-content>{{ t('all_users') }}</v-list-item-content>
|
||||
</v-list-item>
|
||||
|
||||
@@ -181,7 +181,6 @@ import DrawerBatch from '@/views/private/components/drawer-batch.vue';
|
||||
import LayoutSidebarDetail from '@/views/private/components/layout-sidebar-detail.vue';
|
||||
import SearchInput from '@/views/private/components/search-input.vue';
|
||||
import { useLayout } from '@directus/composables';
|
||||
import { Role } from '@directus/types';
|
||||
import { mergeFilters } from '@directus/utils';
|
||||
import { onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router';
|
||||
import useNavigation from '../composables/use-navigation';
|
||||
@@ -191,13 +190,7 @@ type Item = {
|
||||
[field: string]: any;
|
||||
};
|
||||
|
||||
interface Props {
|
||||
role: string | null;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
role: null,
|
||||
});
|
||||
const props = defineProps<{ role?: string }>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -220,7 +213,7 @@ const { confirmDelete, deleting, batchDelete, batchEditActive } = useBatch();
|
||||
const { breadcrumb, title } = useBreadcrumb();
|
||||
|
||||
const roleFilter = computed(() => {
|
||||
if (props.role !== null) {
|
||||
if (props.role) {
|
||||
return {
|
||||
_and: [
|
||||
{
|
||||
@@ -238,7 +231,7 @@ const roleFilter = computed(() => {
|
||||
const canInviteUsers = computed(() => {
|
||||
if (serverStore.auth.disableDefault === true) return false;
|
||||
|
||||
const isAdmin = !!userStore.currentUser?.role?.admin_access;
|
||||
const isAdmin = !!userStore.currentUser?.role.admin_access;
|
||||
if (isAdmin) return true;
|
||||
|
||||
const usersCreatePermission = permissionsStore.permissions.find(
|
||||
@@ -323,7 +316,7 @@ function useBreadcrumb() {
|
||||
|
||||
const title = computed(() => {
|
||||
if (!props.role) return t('user_directory');
|
||||
return roles.value?.find((role: Role) => role.id === props.role)?.name;
|
||||
return roles.value?.find((role) => role.id === props.role)?.name;
|
||||
});
|
||||
|
||||
return { breadcrumb, title };
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="type-label">{{ t('emails') }}</div>
|
||||
<v-textarea v-model="emails" :nullable="false" placeholder="admin@example.com, user@example.com..." />
|
||||
</div>
|
||||
<div v-if="role === null" class="field">
|
||||
<div v-if="!role" class="field">
|
||||
<div class="type-label">{{ t('role') }}</div>
|
||||
<v-select v-model="roleSelected" :items="roles" />
|
||||
</div>
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<v-card-actions>
|
||||
<v-button secondary @click="$emit('update:modelValue', false)">{{ t('cancel') }}</v-button>
|
||||
<v-button :disabled="emails === null || emails.length === 0" :loading="loading" @click="inviteUsers">
|
||||
<v-button :disabled="emails.length === 0" :loading="loading" @click="inviteUsers">
|
||||
{{ t('invite') }}
|
||||
</v-button>
|
||||
</v-card-actions>
|
||||
@@ -118,7 +118,7 @@ async function loadRoles() {
|
||||
value: role.id,
|
||||
}));
|
||||
|
||||
if (roles.value.length > 0 && roleSelected.value === null) {
|
||||
if (roles.value.length > 0 && !roleSelected.value) {
|
||||
roleSelected.value = roles.value[0].value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user