Skip to content

Commit

Permalink
fixed plugin name
Browse files Browse the repository at this point in the history
  • Loading branch information
Christofer Jungberg committed Oct 25, 2022
1 parent 560b68f commit a111f49
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,17 @@ The populate deep option is available for all collections and single types using

# Configuration

The default depth and behaviour for populating creator fields can be customized via the plugin config. To do so create or edit you plugins.js file.
The default depth can be customized via the plugin config. To do so create or edit you plugins.js file.

## Example configuration

`config/plugins.js`

```
module.exports = ({ env }) => ({
'populate-deep': {
enabled: true,
'strapi-plugin-populate-deep': {
config: {
defaultDepth: 3, // Default is 5
skipCreatorFields: false, // Default is true
}
},
});
Expand Down
2 changes: 1 addition & 1 deletion server/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = ({ strapi }) => {
strapi.db.lifecycles.subscribe((event) => {
if (event.action === 'beforeFindMany' || event.action === 'beforeFindOne') {
const populate = event.params?.populate;
const defaultDepth = strapi.plugin('populate-deep')?.config('defaultDepth') || 5
const defaultDepth = strapi.plugin('strapi-plugin-populate-deep')?.config('defaultDepth') || 5

if (populate && populate[0] === 'deep') {
const depth = populate[1] ?? defaultDepth
Expand Down
2 changes: 1 addition & 1 deletion server/helpers/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { isEmpty, merge } = require("lodash/fp");

const skipCreatorFields = strapi.plugin('populate-deep')?.config('skipCreatorFields') || true;
const skipCreatorFields = strapi.plugin('strapi-plugin-populate-deep')?.config('skipCreatorFields') || true;

const getModelPopulationAttributes = (model) => {
if (model.uid === "plugin::upload.file") {
Expand Down

0 comments on commit a111f49

Please sign in to comment.