display warning if webhooks have populated relations

This commit is contained in:
Marc-Roig 2023-01-19 14:54:22 +01:00
parent 6d05a64089
commit ef71bdfd20

View File

@ -64,9 +64,16 @@ const addCreatedByRolesPopulate = (populate) => {
* TODO V5: Make webhooks always send the same entity data.
*/
const isRelationsPopulateEnabled = () => {
return strapi.config.get('admin.relations.populate', true);
return strapi.config.get('server.webhooks.populateRelations', true);
};
if (isRelationsPopulateEnabled()) {
process.emitWarning(
'[deprecated] Relations population in webhooks is enabled. This is not recommended for production and will degrade performance. ' +
'Please set `server.webhooks.populateRelations` to `false` in your `config/server.js` file.'
);
}
const getCountDeepPopulate = (uid) => getDeepPopulate(uid, { countMany: true, countOne: true });
/**