diff --git a/examples/getstarted/api/homepage/models/homepage.settings.json b/examples/getstarted/api/homepage/models/homepage.settings.json index ea1670e9e9..5c5d7f3dc4 100644 --- a/examples/getstarted/api/homepage/models/homepage.settings.json +++ b/examples/getstarted/api/homepage/models/homepage.settings.json @@ -20,7 +20,7 @@ "model": "file", "via": "related", "allowedTypes": [ - "images", + "images", "files", "videos" ], diff --git a/packages/strapi-plugin-upload/admin/src/components/Card/index.js b/packages/strapi-plugin-upload/admin/src/components/Card/index.js index 91964b8547..3b048cea4a 100644 --- a/packages/strapi-plugin-upload/admin/src/components/Card/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/Card/index.js @@ -44,7 +44,7 @@ const Card = ({ : getFileExtension(ext); const handleClick = () => { - if (!isDisabled) { + if (!isDisabled || checked) { onClick(id); } }; diff --git a/packages/strapi-plugin-upload/admin/src/components/List/index.js b/packages/strapi-plugin-upload/admin/src/components/List/index.js index 874cf9d247..fab4e621d3 100644 --- a/packages/strapi-plugin-upload/admin/src/components/List/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/List/index.js @@ -57,7 +57,7 @@ const List = ({ > {(checked || canSelect) && ( <> - {isAllowed && ( + {(checked || isAllowed) && ( allowedFiles.length; if (isSelected) { - draftState.selectedFiles = differenceWith(state.selectedFiles, allowedFiles, comparator); + draftState.selectedFiles = differenceWith(state.selectedFiles, state.files, comparator); break; } diff --git a/packages/strapi-plugin-upload/admin/src/containers/InputModalStepperProvider/tests/reducer.test.js b/packages/strapi-plugin-upload/admin/src/containers/InputModalStepperProvider/tests/reducer.test.js index a4397a152c..1f239c57a1 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/InputModalStepperProvider/tests/reducer.test.js +++ b/packages/strapi-plugin-upload/admin/src/containers/InputModalStepperProvider/tests/reducer.test.js @@ -1088,12 +1088,12 @@ describe('UPLOAD | containers | ModalStepper | reducer', () => { }; expect(reducer(state, action)).toEqual(expected); }); - it('should deselect all files of the current page only', () => { + it('should deselect all files of the current page only event if not allowed', () => { const action = { type: 'TOGGLE_SELECT_ALL', }; const state = { - allowedTypes: [], + allowedTypes: ['video'], selectedFiles: [ { id: 1, @@ -1160,7 +1160,7 @@ describe('UPLOAD | containers | ModalStepper | reducer', () => { ], }; const expected = { - allowedTypes: [], + allowedTypes: ['video'], selectedFiles: [ { id: 1,