Web: Added additional conditions added.

This commit is contained in:
Tatiana Lopaeva 2022-11-18 17:49:48 +03:00
parent c3ffe890ab
commit 7922b78a57
2 changed files with 14 additions and 30 deletions

View File

@ -149,30 +149,6 @@ class AccessRightsStore {
return getFileRoleActions(access).canCopy;
};
generalDeleteProhibitionConditions = (rootFolderType, fileEditing) =>
rootFolderType === FolderType.Archive ||
rootFolderType === FolderType.TRASH ||
rootFolderType === FolderType.Favorites ||
rootFolderType === FolderType.Recent ||
rootFolderType === FolderType.Privacy ||
fileEditing;
canDeleteItsItems = (item) => {
const { rootFolderType, access, editing: fileEditing } = item;
if (this.generalDeleteProhibitionConditions(rootFolderType, fileEditing))
return false;
return getFileRoleActions(access).deleteSelf;
};
canDeleteAlienItems = (item) => {
const { rootFolderType, access, editing: fileEditing } = item;
if (this.generalDeleteProhibitionConditions(rootFolderType, fileEditing))
return false;
return getFileRoleActions(access).deleteAlien;
};
canMakeForm = (item) => {
const { rootFolderType, access } = item;
@ -247,12 +223,20 @@ class AccessRightsStore {
return moveSelf || moveAlien;
};
canDeleteFile = (room) => {
const { rootFolderType } = room;
canDeleteItems = (item) => {
const { rootFolderType, access, editing: fileEditing } = item;
if (rootFolderType === FolderType.Archive) return false;
if (
rootFolderType === FolderType.Archive ||
rootFolderType === FolderType.TRASH ||
rootFolderType === FolderType.Favorites ||
rootFolderType === FolderType.Recent ||
rootFolderType === FolderType.Privacy ||
fileEditing
)
return false;
const { deleteSelf, deleteAlien } = getFileRoleActions(room.access);
const { deleteSelf, deleteAlien } = getFileRoleActions(access);
return deleteSelf || deleteAlien;
};

View File

@ -1269,7 +1269,7 @@ class FilesActionStore {
const {
canCopyItems,
canDeleteFile,
canDeleteItems,
canMoveItems,
canArchiveRoom,
canRemoveRoom,
@ -1314,7 +1314,7 @@ class FilesActionStore {
return canRemove.length > 0;
case "delete":
const canDelete = canDeleteFile({ access, rootFolderType });
const canDelete = canDeleteItems({ access, rootFolderType });
const deleteCondition =
!isThirdPartyRootSelection &&
hasSelection &&