chore: updates global versions test config

This commit is contained in:
Jacob Fletcher
2023-04-17 13:43:31 -04:00
parent a45ab8bd76
commit 78316d4ddc
2 changed files with 40 additions and 12 deletions

View File

@@ -4,7 +4,9 @@ import { autoSaveGlobalSlug } from '../shared';
const AutosaveGlobal: GlobalConfig = { const AutosaveGlobal: GlobalConfig = {
slug: autoSaveGlobalSlug, slug: autoSaveGlobalSlug,
label: 'Autosave Global', label: 'Autosave Global',
preview: () => 'https://payloadcms.com', admin: {
preview: () => 'https://payloadcms.com',
},
versions: { versions: {
max: 20, max: 20,
drafts: { drafts: {
@@ -12,13 +14,25 @@ const AutosaveGlobal: GlobalConfig = {
}, },
}, },
access: { access: {
read: ({ draft, req: { user } }) => { read: ({ req: { user } }) => {
// To read a draft of this global, you need to be authenticated if (user) {
if (draft) { return true;
return Boolean(user);
} }
return true; return {
or: [
{
_status: {
equals: 'published',
},
},
{
_status: {
exists: false,
},
},
],
};
}, },
}, },
fields: [ fields: [

View File

@@ -4,19 +4,33 @@ import { draftGlobalSlug } from '../shared';
const DraftGlobal: GlobalConfig = { const DraftGlobal: GlobalConfig = {
slug: draftGlobalSlug, slug: draftGlobalSlug,
label: 'Draft Global', label: 'Draft Global',
preview: () => 'https://payloadcms.com', admin: {
preview: () => 'https://payloadcms.com',
},
versions: { versions: {
max: 20, max: 20,
drafts: true, drafts: true,
}, },
access: { access: {
read: ({ draft, req: { user } }) => { read: ({ req: { user } }) => {
// To read a draft of this global, you need to be authenticated if (user) {
if (draft) { return true;
return Boolean(user);
} }
return true; return {
or: [
{
_status: {
equals: 'published',
},
},
{
_status: {
exists: false,
},
},
],
};
}, },
}, },
fields: [ fields: [