mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
Merge pull request #5825 from strapi/fix/deselect-not-allowed-files
Allow deselect files
This commit is contained in:
commit
b10c81b339
@ -44,7 +44,7 @@ const Card = ({
|
||||
: getFileExtension(ext);
|
||||
|
||||
const handleClick = () => {
|
||||
if (!isDisabled) {
|
||||
if (!isDisabled || checked) {
|
||||
onClick(id);
|
||||
}
|
||||
};
|
||||
|
@ -57,7 +57,7 @@ const List = ({
|
||||
>
|
||||
{(checked || canSelect) && (
|
||||
<>
|
||||
{isAllowed && (
|
||||
{(checked || isAllowed) && (
|
||||
<CardControlsWrapper leftAlign className="card-control-wrapper">
|
||||
<Checkbox
|
||||
name={`${id}`}
|
||||
|
@ -276,7 +276,7 @@ const reducer = (state, action) =>
|
||||
allowedFiles.length;
|
||||
|
||||
if (isSelected) {
|
||||
draftState.selectedFiles = differenceWith(state.selectedFiles, allowedFiles, comparator);
|
||||
draftState.selectedFiles = differenceWith(state.selectedFiles, state.files, comparator);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user