Skip to content

Commit 9629fc0

Browse files
committed
Merge branch 'main' of github.com:payloadcms/payload into fix/ignore-blocks-deleted-from-the-config
2 parents 114087f + cf87871 commit 9629fc0

File tree

86 files changed

+437
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+437
-450
lines changed

packages/drizzle/src/queries/getTableColumnFromPath.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,10 @@ export const getTableColumnFromPath = ({
799799
`${tableName}_${tableNameSuffix}${toSnakeCase(field.name)}`,
800800
)
801801

802+
const idColumn = (aliasTable ?? adapter.tables[tableName]).id
802803
if (locale && isFieldLocalized && adapter.payload.config.localization) {
803804
const conditions = [
804-
eq(adapter.tables[tableName].id, adapter.tables[newTableName].parent),
805+
eq(idColumn, adapter.tables[newTableName].parent),
805806
eq(adapter.tables[newTableName]._locale, locale),
806807
]
807808

@@ -816,7 +817,7 @@ export const getTableColumnFromPath = ({
816817
})
817818
} else {
818819
addJoinTable({
819-
condition: eq(adapter.tables[tableName].id, adapter.tables[newTableName].parent),
820+
condition: eq(idColumn, adapter.tables[newTableName].parent),
820821
joins,
821822
table: adapter.tables[newTableName],
822823
})

packages/next/src/views/Version/Default/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ export const DefaultVersionView: React.FC<DefaultVersionsViewProps> = ({
238238
<SelectComparison
239239
collectionSlug={collectionSlug}
240240
docID={originalDocID}
241+
globalSlug={globalSlug}
241242
onChange={onChangeVersionFrom}
242243
versionFromID={versionFromID}
243244
versionFromOptions={versionFromOptions}

packages/next/src/views/Version/SelectComparison/VersionDrawer/index.tsx

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ export const formatVersionDrawerSlug = ({
2424
}) => `version-drawer_${depth}_${uuid}`
2525

2626
export const VersionDrawerContent: React.FC<{
27-
collectionSlug: string
28-
docID: number | string
27+
collectionSlug?: string
28+
docID?: number | string
2929
drawerSlug: string
30+
globalSlug?: string
3031
}> = (props) => {
31-
const { collectionSlug, docID, drawerSlug } = props
32+
const { collectionSlug, docID, drawerSlug, globalSlug } = props
3233
const { closeModal } = useModal()
3334
const searchParams = useSearchParams()
3435
const prevSearchParams = useRef(searchParams)
@@ -46,12 +47,20 @@ export const VersionDrawerContent: React.FC<{
4647
setIsLoading(true)
4748

4849
try {
50+
const isGlobal = Boolean(globalSlug)
51+
const entitySlug = collectionSlug ?? globalSlug
52+
4953
const result = await renderDocument({
50-
collectionSlug,
54+
collectionSlug: entitySlug,
5155
docID,
5256
drawerSlug,
5357
paramsOverride: {
54-
segments: ['collections', collectionSlug, String(docID), 'versions'],
58+
segments: [
59+
isGlobal ? 'globals' : 'collections',
60+
entitySlug,
61+
isGlobal ? undefined : String(docID),
62+
'versions',
63+
].filter(Boolean),
5564
},
5665
redirectAfterDelete: false,
5766
redirectAfterDuplicate: false,
@@ -75,7 +84,7 @@ export const VersionDrawerContent: React.FC<{
7584

7685
void fetchDocumentView()
7786
},
78-
[closeModal, collectionSlug, drawerSlug, renderDocument, searchParams, t],
87+
[closeModal, collectionSlug, globalSlug, drawerSlug, renderDocument, searchParams, t],
7988
)
8089

8190
useEffect(() => {
@@ -93,11 +102,12 @@ export const VersionDrawerContent: React.FC<{
93102
return DocumentView
94103
}
95104
export const VersionDrawer: React.FC<{
96-
collectionSlug: string
97-
docID: number | string
105+
collectionSlug?: string
106+
docID?: number | string
98107
drawerSlug: string
108+
globalSlug?: string
99109
}> = (props) => {
100-
const { collectionSlug, docID, drawerSlug } = props
110+
const { collectionSlug, docID, drawerSlug, globalSlug } = props
101111
const { t } = useTranslation()
102112

103113
return (
@@ -107,17 +117,24 @@ export const VersionDrawer: React.FC<{
107117
slug={drawerSlug}
108118
title={t('version:selectVersionToCompare')}
109119
>
110-
<VersionDrawerContent collectionSlug={collectionSlug} docID={docID} drawerSlug={drawerSlug} />
120+
<VersionDrawerContent
121+
collectionSlug={collectionSlug}
122+
docID={docID}
123+
drawerSlug={drawerSlug}
124+
globalSlug={globalSlug}
125+
/>
111126
</Drawer>
112127
)
113128
}
114129

115130
export const useVersionDrawer = ({
116131
collectionSlug,
117132
docID,
133+
globalSlug,
118134
}: {
119-
collectionSlug: string
120-
docID: number | string
135+
collectionSlug?: string
136+
docID?: number | string
137+
globalSlug?: string
121138
}) => {
122139
const drawerDepth = useEditDepth()
123140
const uuid = useId()
@@ -147,9 +164,14 @@ export const useVersionDrawer = ({
147164

148165
const MemoizedDrawer = useMemo(() => {
149166
return () => (
150-
<VersionDrawer collectionSlug={collectionSlug} docID={docID} drawerSlug={drawerSlug} />
167+
<VersionDrawer
168+
collectionSlug={collectionSlug}
169+
docID={docID}
170+
drawerSlug={drawerSlug}
171+
globalSlug={globalSlug}
172+
/>
151173
)
152-
}, [collectionSlug, docID, drawerSlug])
174+
}, [collectionSlug, docID, drawerSlug, globalSlug])
153175

154176
return useMemo(
155177
() => ({

packages/next/src/views/Version/SelectComparison/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ export const SelectComparison: React.FC<Props> = memo((props) => {
1717
const {
1818
collectionSlug,
1919
docID,
20+
globalSlug,
2021
onChange: onChangeFromProps,
2122
versionFromID,
2223
versionFromOptions,
2324
} = props
2425
const { t } = useTranslation()
2526

26-
const { Drawer, openDrawer } = useVersionDrawer({ collectionSlug, docID })
27+
const { Drawer, openDrawer } = useVersionDrawer({ collectionSlug, docID, globalSlug })
2728

2829
const options = useMemo(() => {
2930
return [

packages/next/src/views/Version/SelectComparison/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import type { PaginatedDocs, SanitizedCollectionConfig } from 'payload'
33
import type { CompareOption } from '../Default/types.js'
44

55
export type Props = {
6-
collectionSlug: string
7-
docID: number | string
6+
collectionSlug?: string
7+
docID?: number | string
8+
globalSlug?: string
89
onChange: (val: CompareOption) => void
910
versionFromID?: string
1011
versionFromOptions: CompareOption[]

packages/next/src/views/Version/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ export async function VersionView(props: DocumentViewServerProps) {
425425
VersionToCreatedAtLabel={formatPill({ doc: versionTo, labelStyle: 'pill' })}
426426
versionToID={versionTo.id}
427427
versionToStatus={versionTo.version?._status}
428-
versionToUseAsTitle={versionTo[collectionConfig.admin?.useAsTitle || 'id']}
428+
versionToUseAsTitle={versionTo[collectionConfig?.admin?.useAsTitle || 'id']}
429429
/>
430430
)
431431
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import type { PayloadRequest } from '../types/index.js'
22

3-
export default ({ req: { user } }: { req: PayloadRequest }): boolean => Boolean(user)
3+
export const defaultAccess = ({ req: { user } }: { req: PayloadRequest }): boolean => Boolean(user)

packages/payload/src/auth/endpoints/verifyEmail.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { PayloadHandler } from '../../config/types.js'
44

55
import { getRequestCollectionWithID } from '../../utilities/getRequestEntity.js'
66
import { headersWithCors } from '../../utilities/headersWithCors.js'
7-
import verifyEmailOperation from '../operations/verifyEmail.js'
7+
import { verifyEmailOperation } from '../operations/verifyEmail.js'
88

99
export const verifyEmailHandler: PayloadHandler = async (req) => {
1010
const { id, collection } = getRequestCollectionWithID(req, { disableSanitize: true })

packages/payload/src/auth/executeAccess.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type OperationArgs = {
1010
isReadingStaticFile?: boolean
1111
req: PayloadRequest
1212
}
13-
const executeAccess = async (
13+
export const executeAccess = async (
1414
{ id, data, disableErrors, isReadingStaticFile = false, req }: OperationArgs,
1515
access: Access,
1616
): Promise<AccessResult> => {
@@ -40,5 +40,3 @@ const executeAccess = async (
4040
}
4141
return false
4242
}
43-
44-
export default executeAccess

packages/payload/src/auth/operations/local/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { AuthArgs, AuthResult } from '../auth.js'
44
import { createLocalReq } from '../../../utilities/createLocalReq.js'
55
import { auth as authOperation } from '../auth.js'
66

7-
export const auth = async (payload: Payload, options: AuthArgs): Promise<AuthResult> => {
7+
export const authLocal = async (payload: Payload, options: AuthArgs): Promise<AuthResult> => {
88
const { headers, req } = options
99

1010
return await authOperation({

0 commit comments

Comments
 (0)