Web: Fixed group menu.

This commit is contained in:
Tatiana Lopaeva 2022-12-16 18:07:52 +03:00
parent af82c72665
commit dd3a158428

View File

@ -16,6 +16,7 @@ import {
ConflictResolveType, ConflictResolveType,
FileAction, FileAction,
FileStatus, FileStatus,
FolderType,
} from "@docspace/common/constants"; } from "@docspace/common/constants";
import { makeAutoObservable } from "mobx"; import { makeAutoObservable } from "mobx";
import { isMobile } from "react-device-detect"; import { isMobile } from "react-device-detect";
@ -1275,24 +1276,27 @@ class FilesActionStore {
selection, selection,
} = this.filesStore; } = this.filesStore;
const { canMoveItems } = this.accessRightsStore; const { rootFolderType } = this.selectedFolderStore;
const { access, rootFolderType, security } = this.selectedFolderStore;
switch (option) { switch (option) {
case "copy": case "copy":
return hasSelection && security?.Copy; const canCopy = selection.map((s) => s.security?.Copy).filter((s) => s);
return hasSelection && canCopy;
case "showInfo": case "showInfo":
case "download": case "download":
return hasSelection; return hasSelection;
case "downloadAs": case "downloadAs":
return canConvertSelected; return canConvertSelected;
case "moveTo": case "moveTo":
const canMove = canMoveItems({ const canMove = selection.map((s) => s.security?.Move).filter((r) => r);
security,
rootFolderType, return (
editing: allFilesIsEditing, hasSelection &&
}); !allFilesIsEditing &&
return hasSelection && canMove; canMove &&
rootFolderType !== FolderType.TRASH
);
case "archive": case "archive":
case "unarchive": case "unarchive":
@ -1309,9 +1313,11 @@ class FilesActionStore {
return canRemove.length > 0; return canRemove.length > 0;
case "delete": case "delete":
const canDelete = !allFilesIsEditing && security?.Delete; const canDelete = selection
.map((s) => s.security?.Delete)
.filter((s) => s);
return canDelete && hasSelection; return !allFilesIsEditing && canDelete && hasSelection;
} }
}; };