Merge pull request #106 from ONLYOFFICE/bugfix/dragging-to-trash

Client:Components:Article:Body:Items Fixed dragging to the trash
This commit is contained in:
Nikita Gopienko 2023-12-01 16:08:13 +03:00 committed by GitHub
commit 95d7cfefde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 21 deletions

View File

@ -184,6 +184,7 @@ const Items = ({
isCommunity,
isPaymentPageAvailable,
currentDeviceType,
folderAccess,
}) => {
const getEndOfBlock = React.useCallback(
(item) => {
@ -228,24 +229,15 @@ const Items = ({
return true;
}
if (isAdmin) {
if (
(item.pathParts &&
(item.pathParts[0].id === myId ||
item.pathParts[0].id === commonId)) ||
item.rootFolderType === FolderType.USER ||
item.rootFolderType === FolderType.COMMON ||
(item.rootFolderType === FolderType.TRASH && startDrag && !isArchive)
) {
return true;
}
} else {
if (
(item.pathParts && item.pathParts[0].id === myId) ||
item.rootFolderType === FolderType.USER
) {
return true;
}
if (
(item.rootFolderType === FolderType.TRASH && startDrag && !isArchive) ||
item.rootFolderType === FolderType.USER
) {
return (
folderAccess === ShareAccessRights.None ||
folderAccess === ShareAccessRights.FullAccess ||
folderAccess === ShareAccessRights.RoomManager
);
}
return false;
@ -417,7 +409,7 @@ export default inject(
const { treeFolders, myFolderId, commonFolderId, isPrivacyFolder } =
treeFoldersStore;
const { id } = selectedFolderStore;
const { id, access: folderAccess } = selectedFolderStore;
const {
moveDragItems,
uploadEmptyFolders,
@ -460,6 +452,7 @@ export default inject(
isCommunity,
isPaymentPageAvailable,
currentDeviceType,
folderAccess,
};
}
)(withTranslation(["Files", "Common", "Translations"])(observer(Items)));

View File

@ -41,6 +41,7 @@ const useFiles = ({
gallerySelected,
removeFirstUrl,
folderSecurity,
}) => {
const navigate = useNavigate();
@ -68,6 +69,8 @@ const useFiles = ({
};
const onDrop = (files, uploadToFolder) => {
if (folderSecurity && !folderSecurity.Create) return;
dragging && setDragging(false);
if (disableDrag) return;

View File

@ -42,6 +42,7 @@ const PureHome = (props) => {
setToPreviewFile,
playlist,
folderSecurity,
getFileInfo,
gallerySelected,
setIsUpdatingRowItem,
@ -159,6 +160,7 @@ const PureHome = (props) => {
removeFirstUrl,
gallerySelected,
folderSecurity,
});
const { showUploadPanel } = useOperations({
@ -353,7 +355,7 @@ export default inject(
selectedFolderStore,
clientLoadingStore,
}) => {
const { setSelectedFolder } = selectedFolderStore;
const { setSelectedFolder, security: folderSecurity } = selectedFolderStore;
const {
secondaryProgressDataStore,
primaryProgressDataStore,
@ -494,7 +496,7 @@ export default inject(
isRecycleBinFolder,
isPrivacyFolder,
isVisitor: auth.userStore.user.isVisitor,
folderSecurity,
primaryProgressDataVisible,
primaryProgressDataPercent,
primaryProgressDataIcon,