chore: updates global versions test config
This commit is contained in:
@@ -4,7 +4,9 @@ import { autoSaveGlobalSlug } from '../shared';
|
|||||||
const AutosaveGlobal: GlobalConfig = {
|
const AutosaveGlobal: GlobalConfig = {
|
||||||
slug: autoSaveGlobalSlug,
|
slug: autoSaveGlobalSlug,
|
||||||
label: 'Autosave Global',
|
label: 'Autosave Global',
|
||||||
|
admin: {
|
||||||
preview: () => 'https://payloadcms.com',
|
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: [
|
||||||
|
|||||||
@@ -4,19 +4,33 @@ import { draftGlobalSlug } from '../shared';
|
|||||||
const DraftGlobal: GlobalConfig = {
|
const DraftGlobal: GlobalConfig = {
|
||||||
slug: draftGlobalSlug,
|
slug: draftGlobalSlug,
|
||||||
label: 'Draft Global',
|
label: 'Draft Global',
|
||||||
|
admin: {
|
||||||
preview: () => 'https://payloadcms.com',
|
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: [
|
||||||
|
|||||||
Reference in New Issue
Block a user