Fixed Bug 60990 - Files.Archived.Drag’n’drop. ‘You don't have enough permission to move the file’.

This commit is contained in:
Nikita Gopienko 2023-02-13 15:12:17 +03:00
parent 13976f8101
commit 592e55fb13
5 changed files with 11 additions and 26 deletions

View File

@ -225,7 +225,7 @@ export default function withFileActions(WrappedFileItem) {
itemIndex,
} = this.props;
const { fileExst, access, id } = item;
const { access, id } = item;
const isDragging = isFolder && access < 2 && !isTrashFolder && !isPrivacy;
@ -233,11 +233,7 @@ export default function withFileActions(WrappedFileItem) {
if (draggable) className += " draggable";
let value = !item.isFolder ? `file_${id}` : `folder_${id}`;
value += draggable
? "_draggable"
: item.providerKey
? `_${item.providerKey}`
: "_false";
value += draggable ? "_draggable" : "_false";
value += `_index_${itemIndex}`;

View File

@ -298,7 +298,7 @@ const Items = ({
const onMoveTo = React.useCallback(
(destFolderId, title) => {
moveDragItems(destFolderId, title, null, {
moveDragItems(destFolderId, title, {
copy: t("Translations:CopyOperation"),
move: t("Translations:MoveToOperation"),
});

View File

@ -188,7 +188,6 @@ const SectionBodyContent = (props) => {
const splitValue = treeDataValue && treeDataValue.split(" ");
const isDragging = splitValue && splitValue.includes("dragging");
const treeValue = isDragging ? splitValue[0] : null;
const treeProvider = splitValue && splitValue[splitValue.length - 1];
const elem = e.target.closest(".droppable");
const title = elem && elem.dataset.title;
@ -201,21 +200,20 @@ const SectionBodyContent = (props) => {
}
const folderId = value ? value.split("_")[1] : treeValue;
const providerKey = value ? value.split("_")[2]?.trim() : treeProvider;
setStartDrag(false);
setDragging(false);
onMoveTo(folderId, title, providerKey);
onMoveTo(folderId, title);
isDragActive = false;
return;
};
const onMoveTo = (destFolderId, title, providerKey) => {
const onMoveTo = (destFolderId, title) => {
const id = isNaN(+destFolderId) ? destFolderId : +destFolderId;
moveDragItems(id, title, providerKey, {
moveDragItems(id, title, {
copy: t("Common:CopyOperation"),
move: t("Translations:MoveToOperation"),
}); //TODO: then catch
});
};
const onDropEvent = () => {

View File

@ -1266,24 +1266,15 @@ class FilesActionStore {
.finally(() => setTimeout(() => clearSecondaryProgressData(), TIMEOUT));
};
moveDragItems = (destFolderId, folderTitle, providerKey, translations) => {
moveDragItems = (destFolderId, folderTitle, translations) => {
const folderIds = [];
const fileIds = [];
const deleteAfter = false;
const { selection } = this.filesStore;
const { isRootFolder } = this.selectedFolderStore;
const {
isShareFolder,
isCommonFolder,
isFavoritesFolder,
isRecentFolder,
} = this.treeFoldersStore;
const isCopy =
isShareFolder ||
isFavoritesFolder ||
isRecentFolder ||
(!this.authStore.isAdmin && isCommonFolder);
const isCopy = selection.findIndex((f) => f.security.Move) === -1;
const operationData = {
destFolderId,

View File

@ -2438,7 +2438,7 @@ class FilesStore {
const previewUrl = canOpenPlayer
? this.getItemUrl(id, false, needConvert, canOpenPlayer)
: null;
const contextOptions = this.getFilesContextOptions(item, canOpenPlayer);
const contextOptions = this.getFilesContextOptions(item);
const isThirdPartyFolder = providerKey && id === rootFolderId;
const iconSize = this.viewAs === "table" ? 24 : 32;