Merge branch 'releases/v4' of github.com:strapi/strapi into webhooks/add-combobox

This commit is contained in:
soupette 2021-10-21 15:41:30 +02:00
commit 6d8b85ecaf
5 changed files with 2 additions and 39 deletions

View File

@ -103,6 +103,7 @@ const pickPopulateParams = _.pick([
'orderBy',
'limit',
'offset',
'filters',
]);
// TODO: cleanup code
@ -123,8 +124,8 @@ const applyPopulate = async (results, populate, ctx) => {
const targetMeta = db.metadata.get(attribute.target);
const populateValue = {
...pickPopulateParams(populate[key]),
filters: qb.state.filters,
...pickPopulateParams(populate[key]),
};
const isCount = populateValue.count === true;

View File

@ -60,23 +60,6 @@ module.exports = {
ctx.body = pm.sanitize(file, { withPrivate: false });
},
async count(ctx) {
const pm = strapi.admin.services.permission.createPermissionsManager({
ability: ctx.state.userAbility,
action: ACTIONS.read,
model: fileModel,
});
if (!pm.isAllowed) {
return ctx.forbidden();
}
const query = pm.addPermissionsQueryTo(ctx.query);
const count = await getService('upload').count(query);
ctx.body = { count };
},
async destroy(ctx) {
const { id } = ctx.params;
const { userAbility } = ctx.state;

View File

@ -43,22 +43,6 @@ module.exports = {
policies: ['admin::isAuthenticatedAdmin'],
},
},
{
method: 'GET',
path: '/files/count',
handler: 'admin-api.count',
config: {
policies: [
'admin::isAuthenticatedAdmin',
{
name: 'admin::hasPermissions',
config: {
actions: ['plugin::upload.read'],
},
},
],
},
},
{
method: 'GET',
path: '/files',

View File

@ -310,10 +310,6 @@ module.exports = ({ strapi }) => ({
return strapi.entityService.findPage('plugin::upload.file', query);
},
count(query) {
return strapi.entityService.count('plugin::upload.file', query);
},
async remove(file) {
const config = strapi.config.get('plugin.upload');

View File

@ -162,7 +162,6 @@ describe('Upload plugin end to end tests', () => {
});
});
test.todo('GET /upload/files/count => Count available files');
test.todo('GET /upload/files/:id => Find one file');
test.todo('GET /upload/search/:id => Search files');
test.todo('DELETE /upload/files/:id => Delete a file');