From 8edd95ad71fa7fc8765fc5b050d3d8a636a7acec Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 1 Oct 2021 11:58:26 +0300 Subject: [PATCH 1/3] Web: Files: fixed operations for selected files --- .../Client/src/components/dialogs/DeleteDialog/index.js | 6 +++--- .../src/components/dialogs/ThirdPartyMoveDialog/index.js | 2 +- .../src/components/panels/ChangeOwnerPanel/index.js | 2 +- .../Client/src/components/panels/OperationsPanel/index.js | 2 +- .../Client/src/components/panels/SharingPanel/index.js | 6 +++--- products/ASC.Files/Client/src/store/FilesActionsStore.js | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/products/ASC.Files/Client/src/components/dialogs/DeleteDialog/index.js b/products/ASC.Files/Client/src/components/dialogs/DeleteDialog/index.js index 143efbc43a0..7acfc8d257f 100644 --- a/products/ASC.Files/Client/src/components/dialogs/DeleteDialog/index.js +++ b/products/ASC.Files/Client/src/components/dialogs/DeleteDialog/index.js @@ -277,9 +277,9 @@ export default inject( return { selection: removeMediaItem ? [removeMediaItem] - : bufferSelection - ? [bufferSelection] - : selection, + : selection.length + ? selection + : [bufferSelection], isLoading, isRootFolder: selectedFolderStore.isRootFolder, visible, diff --git a/products/ASC.Files/Client/src/components/dialogs/ThirdPartyMoveDialog/index.js b/products/ASC.Files/Client/src/components/dialogs/ThirdPartyMoveDialog/index.js index 42dec6dbda3..401e0a11ade 100644 --- a/products/ASC.Files/Client/src/components/dialogs/ThirdPartyMoveDialog/index.js +++ b/products/ASC.Files/Client/src/components/dialogs/ThirdPartyMoveDialog/index.js @@ -112,7 +112,7 @@ export default inject(({ filesStore, dialogsStore, filesActionsStore }) => { const { bufferSelection, setBufferSelection } = filesStore; const { checkOperationConflict } = filesActionsStore; - const selection = bufferSelection ? [bufferSelection] : filesStore.selection; + const selection = selection.length ? filesStore.selection : [bufferSelection]; return { visible, diff --git a/products/ASC.Files/Client/src/components/panels/ChangeOwnerPanel/index.js b/products/ASC.Files/Client/src/components/panels/ChangeOwnerPanel/index.js index cdba7c79d33..fd49927c23b 100644 --- a/products/ASC.Files/Client/src/components/panels/ChangeOwnerPanel/index.js +++ b/products/ASC.Files/Client/src/components/panels/ChangeOwnerPanel/index.js @@ -158,7 +158,7 @@ export default inject(({ auth, filesStore, dialogsStore }) => { return { groupsCaption: auth.settingsStore.customNames.groupsCaption, - selection: bufferSelection ? [bufferSelection] : selection, + selection: selection.length ? selection : [bufferSelection], isLoading, visible: ownerPanelVisible, diff --git a/products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js b/products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js index 111bcf1c33d..836f7e15530 100644 --- a/products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js +++ b/products/ASC.Files/Client/src/components/panels/OperationsPanel/index.js @@ -165,7 +165,7 @@ export default inject( setThirdPartyMoveDialogVisible, } = dialogsStore; - const selections = bufferSelection ? [bufferSelection] : selection; + const selections = selection.length ? selection : [bufferSelection]; const provider = selections.find((x) => x.providerKey); diff --git a/products/ASC.Files/Client/src/components/panels/SharingPanel/index.js b/products/ASC.Files/Client/src/components/panels/SharingPanel/index.js index a538f86e5d3..ffebc10c5c8 100644 --- a/products/ASC.Files/Client/src/components/panels/SharingPanel/index.js +++ b/products/ASC.Files/Client/src/components/panels/SharingPanel/index.js @@ -656,9 +656,9 @@ const SharingPanel = inject( homepage: config.homepage, selection: uploadPanelVisible ? selectedUploadFile - : bufferSelection - ? [bufferSelection] - : selection, + : selection.length + ? selection + : [bufferSelection], isLoading, isPrivacy: isPrivacyFolder, selectedUploadFile, diff --git a/products/ASC.Files/Client/src/store/FilesActionsStore.js b/products/ASC.Files/Client/src/store/FilesActionsStore.js index 21f7512b89c..d088928bf69 100644 --- a/products/ASC.Files/Client/src/store/FilesActionsStore.js +++ b/products/ASC.Files/Client/src/store/FilesActionsStore.js @@ -231,9 +231,9 @@ class FilesActionStore { } = this.uploadDataStore.secondaryProgressDataStore; const { bufferSelection } = this.filesStore; - const selection = bufferSelection - ? [bufferSelection] - : this.filesStore.selection; + const selection = this.filesStore.selection.length + ? this.filesStore.selection + : [bufferSelection]; const fileIds = []; const folderIds = []; @@ -314,7 +314,7 @@ class FilesActionStore { onSelectItem = ({ id, isFolder }) => { const { setBufferSelection, selected, setSelected } = this.filesStore; - selected === "close" && setSelected("none"); + /* selected === "close" && */ setSelected("none"); if (!id) return; From dcf16ec0f206f69816cd48ea98e1723249f8a214 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 1 Oct 2021 13:09:50 +0300 Subject: [PATCH 2/3] Web: Files: fixed ChangeOwnerPanel --- .../Client/src/components/panels/ChangeOwnerPanel/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/products/ASC.Files/Client/src/components/panels/ChangeOwnerPanel/index.js b/products/ASC.Files/Client/src/components/panels/ChangeOwnerPanel/index.js index fd49927c23b..7dbdcdc6845 100644 --- a/products/ASC.Files/Client/src/components/panels/ChangeOwnerPanel/index.js +++ b/products/ASC.Files/Client/src/components/panels/ChangeOwnerPanel/index.js @@ -79,9 +79,9 @@ class ChangeOwnerComponent extends React.Component { const { showPeopleSelector, owner } = this.state; const ownerName = owner.displayName ? owner.displayName : owner.label; - const fileName = selection[0].title; + const fileName = selection[0]?.title; const id = owner.id ? owner.id : owner.key; - const disableSaveButton = owner && selection[0].createdBy.id === id; + const disableSaveButton = owner && selection[0]?.createdBy.id === id; const zIndex = 310; return ( From 6b326e8e273fed4e4c6563e129b14f456dbd54fd Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 1 Oct 2021 13:29:46 +0300 Subject: [PATCH 3/3] Web: Files: fixed bufferSelection item --- products/ASC.Files/Client/src/store/FilesActionsStore.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/products/ASC.Files/Client/src/store/FilesActionsStore.js b/products/ASC.Files/Client/src/store/FilesActionsStore.js index d088928bf69..e1012b95e9e 100644 --- a/products/ASC.Files/Client/src/store/FilesActionsStore.js +++ b/products/ASC.Files/Client/src/store/FilesActionsStore.js @@ -322,6 +322,8 @@ class FilesActionStore { (elm) => elm.id === id ); + item.isFolder = isFolder; + setBufferSelection(item); };