Merge branch 'release/rc-v1.2.0' into feature/new-user-type-change

This commit is contained in:
Alexey Safronov 2023-01-31 00:29:39 +03:00
commit bae287b32b
10 changed files with 54 additions and 30 deletions

View File

@ -92,13 +92,14 @@ const ThirdPartyStorage = ({
return (
<StyledThirdPartyStorage>
{/* //TODO: Uncomment when third-party storages will be stable
<ToggleParam
id="shared_third-party-storage-toggle"
title={t("ThirdPartyStorageTitle")}
description={t("ThirdPartyStorageDescription")}
isChecked={storageLocation.isThirdparty}
onCheckedChange={onChangeIsThirdparty}
/>
/> */}
{storageLocation.isThirdparty && (
<ThirdPartyComboBox

View File

@ -28,6 +28,7 @@ const FilesMediaViewer = (props) => {
setCurrentId,
setBufferSelection,
isFavoritesFolder,
archiveRoomsId,
onClickFavorite,
onShowInfoPanel,
onClickDownload,
@ -163,6 +164,7 @@ const FilesMediaViewer = (props) => {
onDownload={onDownloadMediaFile}
onClickFavorite={onClickFavorite}
setBufferSelection={setBufferSelection}
archiveRoomsId={archiveRoomsId}
files={files}
onClickDownload={onClickDownload}
onShowInfoPanel={onShowInfoPanel}
@ -217,7 +219,7 @@ export default inject(
} = mediaViewerDataStore;
const { deleteItemAction } = filesActionsStore;
const { getIcon, extsImagePreviewed, extsMediaPreviewed } = settingsStore;
const { isFavoritesFolder } = treeFoldersStore;
const { isFavoritesFolder, archiveRoomsId } = treeFoldersStore;
const {
onClickFavorite,
@ -262,6 +264,7 @@ export default inject(
getIcon,
onCopyAction,
onDuplicate,
archiveRoomsId,
};
}
)(

View File

@ -33,6 +33,7 @@ const GeneralSettings = ({
isChecked={storeForceSave}
/>
</Box>
{/* //TODO: Uncomment when third-party storages will be stable
<Box className="settings-section">
<Heading className="heading" level={2} size="xsmall">
{t("ThirdPartyAccounts")}
@ -43,7 +44,7 @@ const GeneralSettings = ({
onChange={onChangeThirdParty}
isChecked={enableThirdParty}
/>
</Box>
</Box> */}
</StyledSettings>
);
};

View File

@ -150,12 +150,19 @@ class FilesStore {
case "create":
if (opt?.type === "file" && opt?.id) {
const foundIndex = this.files.findIndex((x) => x.id === opt?.id);
if (foundIndex > -1) return;
const file = JSON.parse(opt?.data);
if (this.selectedFolderStore.id !== file.folderId) return;
//To update a file version
if (foundIndex > -1 && !withPaging) {
this.getFileInfo(file.id);
this.checkSelection(file);
}
if (foundIndex > -1) return;
const fileInfo = await api.files.getFileInfo(file.id);
console.log("[WS] create new file", fileInfo.id, fileInfo.title);
@ -214,27 +221,7 @@ class FilesStore {
console.log("[WS] update file", file.id, file.title);
if (this.selection) {
const foundIndex = this.selection?.findIndex(
(x) => x.id === file.id
);
if (foundIndex > -1) {
runInAction(() => {
this.selection[foundIndex] = file;
});
}
}
if (this.bufferSelection) {
const foundIndex = [this.bufferSelection].findIndex(
(x) => x.id === file.id
);
if (foundIndex > -1) {
runInAction(() => {
this.bufferSelection[foundIndex] = file;
});
}
}
this.checkSelection(file);
} else if (opt?.type === "folder" && opt?.data) {
const folder = JSON.parse(opt?.data);
@ -463,6 +450,28 @@ class FilesStore {
this.clearSearch = clearSearch;
};
checkSelection = (file) => {
if (this.selection) {
const foundIndex = this.selection?.findIndex((x) => x.id === file.id);
if (foundIndex > -1) {
runInAction(() => {
this.selection[foundIndex] = file;
});
}
}
if (this.bufferSelection) {
const foundIndex = [this.bufferSelection].findIndex(
(x) => x.id === file.id
);
if (foundIndex > -1) {
runInAction(() => {
this.bufferSelection[foundIndex] = file;
});
}
}
};
updateSelectionStatus = (id, status, isEditing) => {
const index = this.selection.findIndex((x) => x.id === id);

View File

@ -755,7 +755,6 @@ class UploadDataStore {
path,
t
) => {
this.filesStore.setOperationAction(true);
const length = requestsDataArray.length;
for (let index = 0; index < length; index++) {
if (

View File

@ -493,6 +493,7 @@ class MediaViewer extends React.Component {
onClickDelete,
setBufferSelection,
files,
archiveRoomsId,
} = this.props;
const currentFileId =
@ -504,6 +505,8 @@ class MediaViewer extends React.Component {
const targetFile =
files.find((item) => item.id === currentFileId) || playlist[0];
const archiveRoom = archiveRoomsId === targetFile.rootFolderId;
const { title } = currentFile;
let isImage = false;
@ -535,14 +538,14 @@ class MediaViewer extends React.Component {
label: t("Rename"),
icon: RenameReactSvgUrl,
onClick: () => onClickRename(targetFile),
disabled: false,
disabled: archiveRoom,
},
{
key: "delete",
label: t("Common:Delete"),
icon: TrashReactSvgUrl,
onClick: () => onClickDelete(targetFile, t),
disabled: false,
disabled: archiveRoom,
},
];
@ -599,7 +602,7 @@ class MediaViewer extends React.Component {
label: t("Rename"),
icon: RenameReactSvgUrl,
onClick: () => onClickRename(targetFile),
disabled: isPreviewFile,
disabled: archiveRoom,
},
{
@ -673,6 +676,7 @@ class MediaViewer extends React.Component {
isPreviewFile={isPreviewFile}
audioIcon={audioIcon}
onDownloadClick={this.onDownload}
archiveRoom={archiveRoom}
// isFavoritesFolder={isFavoritesFolder}
/>
)}

View File

@ -186,6 +186,7 @@ class ImageViewer extends React.Component {
isAudio,
isVideo,
isPreviewFile,
archiveRoom,
contextModel,
audioIcon,
headerIcon,
@ -213,6 +214,8 @@ class ImageViewer extends React.Component {
manualX={(right || "-31") + "px"}
>
{model.map((item) => {
if (item.disabled) return;
const onClick = (e) => {
onClose();
onItemClick(e, item);
@ -377,6 +380,7 @@ class ImageViewer extends React.Component {
isAudio={isAudio}
isVideo={isVideo}
isPreviewFile={isPreviewFile}
archiveRoom={archiveRoom}
audioIcon={audioIcon}
onSetSelectionFile={onSetSelectionFile}
onMaskClick={onClose}

View File

@ -33,6 +33,7 @@ export const Viewer = (props) => {
playlist,
isImage,
isAudio,
archiveRoom,
audioIcon,
contextModel,
generateContextMenu,

View File

@ -51,6 +51,7 @@ const ViewerBase = (props) => {
onPrevClick,
onMaskClick,
isPreviewFile,
archiveRoom,
} = props;
const initialState = {
@ -709,6 +710,7 @@ const ViewerBase = (props) => {
percent={state.percent}
attribute={attribute}
isPreviewFile={isPreviewFile}
archiveRoom={archiveRoom}
setIsOpenContextMenu={props.setIsOpenContextMenu}
zoomable={zoomable}
rotatable={rotatable}

View File

@ -187,7 +187,7 @@ export default function ViewerToolbar(props) {
toolbars = deleteToolbarFromKey(toolbars, ["scaleX", "scaleY"]);
}
if (props.isPreviewFile) {
if (props.isPreviewFile || props.archiveRoom) {
toolbars = deleteToolbarFromKey(toolbars, [
"context-menu",
"context-separator",