Skip to content

Commit

Permalink
Merge pull request #366 from ONLYOFFICE/bugfix/fixed-selected-items-o…
Browse files Browse the repository at this point in the history
…perations

Bugfix/fixed selected items operations
  • Loading branch information
ilyaoleshko authored Oct 1, 2021
2 parents 1df1e12 + 6b326e8 commit 7e2d4f0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ export default inject(
return {
selection: removeMediaItem
? [removeMediaItem]
: bufferSelection
? [bufferSelection]
: selection,
: selection.length
? selection
: [bufferSelection],
isLoading,
isRootFolder: selectedFolderStore.isRootFolder,
visible,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,9 @@ const SharingPanel = inject(
homepage: config.homepage,
selection: uploadPanelVisible
? selectedUploadFile
: bufferSelection
? [bufferSelection]
: selection,
: selection.length
? selection
: [bufferSelection],
isLoading,
isPrivacy: isPrivacyFolder,
selectedUploadFile,
Expand Down
10 changes: 6 additions & 4 deletions products/ASC.Files/Client/src/store/FilesActionsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -314,14 +314,16 @@ class FilesActionStore {

onSelectItem = ({ id, isFolder }) => {
const { setBufferSelection, selected, setSelected } = this.filesStore;
selected === "close" && setSelected("none");
/* selected === "close" && */ setSelected("none");

if (!id) return;

const item = this.filesStore[isFolder ? "folders" : "files"].find(
(elm) => elm.id === id
);

item.isFolder = isFolder;

setBufferSelection(item);
};

Expand Down

0 comments on commit 7e2d4f0

Please sign in to comment.