mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 15:44:59 +00:00
fix tests
Signed-off-by: Pierre Noël <petersg83@gmail.com>
This commit is contained in:
parent
74a85c1127
commit
09ae61ffab
@ -158,7 +158,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
const data = await validateUploadBody(body);
|
||||
const file = await uploadService.replace(id, { data, file: files, user });
|
||||
const file = await uploadService.replace(id, { data, file: files }, { user });
|
||||
|
||||
ctx.body = pm.sanitize(file, { action: ACTIONS.read });
|
||||
},
|
||||
@ -181,7 +181,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
const data = await validateUploadBody(body);
|
||||
const file = await uploadService.upload({ data, files, user });
|
||||
const file = await uploadService.upload({ data, files }, { user });
|
||||
|
||||
ctx.body = pm.sanitize(file, { action: ACTIONS.read });
|
||||
},
|
||||
|
||||
@ -108,7 +108,7 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
async upload({ data, files, user }) {
|
||||
async upload({ data, files }, { user } = {}) {
|
||||
const { fileInfo, ...metas } = data;
|
||||
|
||||
const fileArray = Array.isArray(files) ? files : [files];
|
||||
@ -170,7 +170,7 @@ module.exports = {
|
||||
return this.add(fileData, { user });
|
||||
},
|
||||
|
||||
async updateFileInfo(id, { name, alternativeText, caption }, { user }) {
|
||||
async updateFileInfo(id, { name, alternativeText, caption }, { user } = {}) {
|
||||
const dbFile = await this.fetch({ id });
|
||||
|
||||
if (!dbFile) {
|
||||
@ -186,7 +186,7 @@ module.exports = {
|
||||
return this.update({ id }, newInfos, { user });
|
||||
},
|
||||
|
||||
async replace(id, { data, file, user }) {
|
||||
async replace(id, { data, file }, { user } = {}) {
|
||||
const config = strapi.plugins.upload.config;
|
||||
|
||||
const {
|
||||
@ -261,7 +261,7 @@ module.exports = {
|
||||
return this.update({ id }, fileData, { user });
|
||||
},
|
||||
|
||||
async update(params, values, { user }) {
|
||||
async update(params, values, { user } = {}) {
|
||||
const fileValues = { ...values };
|
||||
if (user) {
|
||||
fileValues[UPDATED_BY_ATTRIBUTE] = user.id;
|
||||
@ -274,7 +274,7 @@ module.exports = {
|
||||
return res;
|
||||
},
|
||||
|
||||
async add(values, { user }) {
|
||||
async add(values, { user } = {}) {
|
||||
const fileValues = { ...values };
|
||||
if (user) {
|
||||
fileValues[UPDATED_BY_ATTRIBUTE] = user.id;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user