Explicitly nullify user/role when the other is set in presets (#7512)

Fixes #7366
This commit is contained in:
Rijk van Zanten
2021-08-20 00:15:43 +02:00
committed by GitHub
parent 256139ffd2
commit ebb810b9af
3 changed files with 6 additions and 2 deletions

View File

@@ -8,7 +8,8 @@ import { useI18n } from 'vue-i18n';
import { toRefs, computed, ref, watch, Ref } from 'vue';
import { CameraOptions, AnyLayer } from 'maplibre-gl';
import { GeometryOptions, toGeoJSON } from '@/utils/geometry';
import { toGeoJSON } from '@/utils/geometry';
import { GeometryOptions } from '@directus/shared/types';
import { layers } from './style';
import { useRouter } from 'vue-router';
import { Filter } from '@directus/shared/types';
@@ -56,7 +57,7 @@ export default defineLayout<LayoutOptions, LayoutQuery>({
const page = syncOption(layoutQuery, 'page', 1);
const limit = syncOption(layoutQuery, 'limit', 1000);
const sort = syncOption(layoutQuery, 'sort', fieldsInCollection.value[0].field);
const sort = syncOption(layoutQuery, 'sort', fieldsInCollection.value?.[0]?.field);
const customLayerDrawerOpen = ref(false);
const layoutElement = ref<HTMLElement | null>(null);

View File

@@ -218,8 +218,10 @@ export default defineComponent({
if (edits.value.scope) {
if (edits.value.scope.startsWith('role_')) {
editsParsed.role = edits.value.scope.substring(5);
editsParsed.user = null;
} else if (edits.value.scope.startsWith('user_')) {
editsParsed.user = edits.value.scope.substring(5);
editsParsed.role = null;
} else {
editsParsed.role = null;
editsParsed.user = null;

View File

@@ -7,6 +7,7 @@ export interface LayoutConfig<Options = any, Query = any> {
name: string;
icon: string;
component: Component;
smallHeader?: boolean;
slots: {
options: Component;
sidebar: Component;