mirror of
https://github.com/strapi/strapi.git
synced 2025-08-09 17:26:11 +00:00
handle populate: false
This commit is contained in:
parent
0ab458fe0d
commit
69945fd9bb
@ -83,6 +83,10 @@ const processPopulate = (populate, ctx) => {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (populateMap[key] === false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// make sure id is present for future populate queries
|
// make sure id is present for future populate queries
|
||||||
if (_.has('id', meta.attributes)) {
|
if (_.has('id', meta.attributes)) {
|
||||||
qb.addSelect('id');
|
qb.addSelect('id');
|
||||||
|
@ -300,5 +300,19 @@ describe('Populate filters', () => {
|
|||||||
|
|
||||||
expect(body.data[0].attributes.third.data[0].attributes.fooRef).toBeUndefined();
|
expect(body.data[0].attributes.third.data[0].attributes.fooRef).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Don't populate with object and 'f'", async () => {
|
||||||
|
const qs = {
|
||||||
|
populate: {
|
||||||
|
third: 'f',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const { status, body } = await rq.get(`/${schemas.contentTypes.c.pluralName}`, { qs });
|
||||||
|
|
||||||
|
expect(status).toBe(200);
|
||||||
|
expect(body.data).toHaveLength(2);
|
||||||
|
|
||||||
|
expect(body.data[0].attributes.third).toBeUndefined();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user