fix: #2937, depth not being respected in graphql rich text fields
This commit is contained in:
@@ -11,6 +11,7 @@ function loginResolver(collection: Collection) {
|
||||
},
|
||||
req: context.req,
|
||||
res: context.res,
|
||||
depth: 0,
|
||||
};
|
||||
|
||||
const result = login(options);
|
||||
|
||||
@@ -6,6 +6,7 @@ function meResolver(collection: Collection): any {
|
||||
const options = {
|
||||
collection,
|
||||
req: context.req,
|
||||
depth: 0,
|
||||
};
|
||||
return me(options);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ function refreshResolver(collection: Collection) {
|
||||
token,
|
||||
req: context.req,
|
||||
res: context.res,
|
||||
depth: 0,
|
||||
};
|
||||
|
||||
const result = await refresh(options);
|
||||
|
||||
@@ -13,6 +13,7 @@ function resetPasswordResolver(collection: Collection) {
|
||||
req: context.req,
|
||||
res: context.res,
|
||||
api: 'GraphQL',
|
||||
depth: 0,
|
||||
};
|
||||
|
||||
const result = await resetPassword(options);
|
||||
|
||||
@@ -23,6 +23,7 @@ export type Arguments = {
|
||||
req: PayloadRequest
|
||||
overrideAccess?: boolean
|
||||
res?: Response
|
||||
depth?: number
|
||||
}
|
||||
|
||||
async function resetPassword(args: Arguments): Promise<Result> {
|
||||
@@ -45,6 +46,7 @@ async function resetPassword(args: Arguments): Promise<Result> {
|
||||
},
|
||||
overrideAccess,
|
||||
data,
|
||||
depth,
|
||||
} = args;
|
||||
|
||||
// /////////////////////////////////////
|
||||
@@ -119,7 +121,7 @@ async function resetPassword(args: Arguments): Promise<Result> {
|
||||
args.res.cookie(`${config.cookiePrefix}-token`, token, cookieOptions);
|
||||
}
|
||||
|
||||
const fullUser = await payload.findByID({ collection: collectionConfig.slug, id: user.id, overrideAccess });
|
||||
const fullUser = await payload.findByID({ collection: collectionConfig.slug, id: user.id, overrideAccess, depth });
|
||||
return { token, user: fullUser };
|
||||
}
|
||||
|
||||
|
||||
@@ -33,13 +33,8 @@ export async function afterRead<T = any>(args: Args): Promise<T> {
|
||||
const fieldPromises = [];
|
||||
const populationPromises = [];
|
||||
|
||||
let depth = 0;
|
||||
|
||||
if (req.payloadAPI === 'REST' || req.payloadAPI === 'local') {
|
||||
depth = (incomingDepth || incomingDepth === 0) ? parseInt(String(incomingDepth), 10) : req.payload.config.defaultDepth;
|
||||
|
||||
if (depth > req.payload.config.maxDepth) depth = req.payload.config.maxDepth;
|
||||
}
|
||||
let depth = (incomingDepth || incomingDepth === 0) ? parseInt(String(incomingDepth), 10) : req.payload.config.defaultDepth;
|
||||
if (depth > req.payload.config.maxDepth) depth = req.payload.config.maxDepth;
|
||||
|
||||
const currentDepth = incomingCurrentDepth || 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user