Skip to content

Commit b9868c4

Browse files
authored
fix: allow custom admin user collection in query presets constraints (#12202)
Query preset "Specific User" constraints is currently fixed to `users` collection. However, this will fail if one has a custom admin user collection.
1 parent e5b28c9 commit b9868c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/payload/src/query-presets/constraints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const getConstraints = (config: Config): Field => ({
7474
},
7575
],
7676
},
77-
relationTo: 'users',
77+
relationTo: config.admin?.user ?? 'users', // TODO: remove this fallback when the args are properly typed as `SanitizedConfig`
7878
},
7979
...(config?.queryPresets?.constraints?.[operation]?.reduce(
8080
(acc: Field[], option: QueryPresetConstraint) => {

0 commit comments

Comments
 (0)