Web:Client:Fixed lack of copying files to the room, lack of toastr.

This commit is contained in:
Vlada Gazizova 2023-10-13 17:55:06 +03:00
parent 7c411c429d
commit dcdf3778bd
2 changed files with 17 additions and 20 deletions

View File

@ -84,6 +84,8 @@ class CreateEditRoomStore {
calculateRoomLogoParams,
uploadRoomLogo,
addLogoToRoom,
selection,
bufferSelection,
} = this.filesStore;
const { preparingDataForCopyingToRoom } = this.filesActionsStore;
@ -154,8 +156,16 @@ class CreateEditRoomStore {
});
} else !withPaging && this.onOpenNewRoom(room);
if (processCreatingRoomFromData)
preparingDataForCopyingToRoom(room.id, t);
if (processCreatingRoomFromData) {
const selections =
selection.length > 0 && selection[0] != null
? selection
: bufferSelection != null
? [bufferSelection]
: [];
preparingDataForCopyingToRoom(room.id, selections, t);
}
this.roomIsCreated = true;
} catch (err) {

View File

@ -2357,19 +2357,10 @@ class FilesActionStore {
this.isGroupMenuBlocked = blocked;
};
preparingDataForCopyingToRoom = async (destFolderId, t) => {
const { selection, bufferSelection } = this.filesStore;
preparingDataForCopyingToRoom = async (destFolderId, selections, t) => {
let fileIds = [];
let folderIds = [];
const selections =
selection.length > 0 && selection[0] != null
? selection
: bufferSelection != null
? [bufferSelection]
: [];
if (!selections.length) return;
const oneFolder = selections.length === 1 && selections[0].isFolder;
@ -2380,18 +2371,14 @@ class FilesActionStore {
const selectedFolder = await getFolder(selections[0].id);
const { folders, files, total } = selectedFolder;
if (total > 1) this.setSelectedItems(false, total);
if (total === 1) {
const title = !!folders.length ? folders[0].title : files[0].title;
this.setSelectedItems(title, total);
}
if (total === 0) {
this.filesStore.setSelection([]);
this.filesStore.setBufferSelection(null);
return;
}
const title = !!folders.length ? folders[0].title : files[0].title;
this.setSelectedItems(title, total);
} catch (err) {
toastr.error(err);
}
@ -2403,7 +2390,7 @@ class FilesActionStore {
else folderIds.push(item.id);
});
!oneFolder && this.setSelectedItems();
!oneFolder && this.setSelectedItems(selections[0].title, selections.length);
this.filesStore.setSelection([]);
this.filesStore.setBufferSelection(null);