Merge branch 'release/v1.2' of github.com:ONLYOFFICE/AppServer into release/v1.2

This commit is contained in:
Timofey Boyko 2022-05-05 12:17:35 +03:00
commit 7809835047
3 changed files with 12 additions and 42 deletions

View File

@ -18,20 +18,9 @@ import { inject, observer } from "mobx-react";
import config from "../../../../package.json";
class PureVersionHistoryPanel extends React.Component {
componentDidUpdate(preProps) {
const { isTabletView, fileId } = this.props;
if (isTabletView !== preProps.isTabletView && isTabletView) {
this.redirectToPage(fileId);
}
}
redirectToPage = (fileId) => {
this.onClose();
history.replace(`${this.props.homepage}/${fileId}/history`);
};
onClose = () => {
this.props.setIsVerHistoryPanel(false);
const { setIsVerHistoryPanel } = this.props;
setIsVerHistoryPanel(false);
};
render() {

View File

@ -10,32 +10,6 @@ import { SectionHeaderContent, SectionBodyContent } from "./Section";
import { inject, observer } from "mobx-react";
class PureVersionHistory extends React.Component {
componentDidMount() {
const { isTabletView } = this.props;
if (!isTabletView) {
this.redirectToPanelView();
}
}
componentDidUpdate(prevProps) {
const { isTabletView } = this.props;
if (isTabletView !== prevProps.isTabletView && !isTabletView) {
this.redirectToPanelView();
}
}
redirectToPanelView = () => {
const { setIsVerHistoryPanel } = this.props;
setIsVerHistoryPanel(true);
this.redirectToHomepage();
};
redirectToHomepage = () => {
const { history } = this.props;
history.goBack();
};
render() {
const { isLoading, versions, showProgressBar } = this.props;

View File

@ -16,8 +16,7 @@ class VersionHistoryStore {
makeAutoObservable(this);
this.filesStore = filesStore;
const isTabletView = window.innerWidth <= size.tablet;
if (isTabletView && this.versions) {
if (this.versions) {
//TODO: Files store in not initialized on versionHistory page. Need socket.
const { socketHelper } = this.filesStore.settingsStore;
@ -52,13 +51,21 @@ class VersionHistoryStore {
setIsVerHistoryPanel = (isVisible) => {
this.isVisible = isVisible;
!isVisible && this.setVerHistoryFileId(null);
if (!isVisible) {
this.setVersions(null);
this.setVerHistoryFileId(null);
}
};
setVerHistoryFileId = (fileId) => {
this.fileId = fileId;
};
setVersions = (versions) => {
this.versions = versions;
};
//setFileVersions
setVerHistoryFileVersions = (versions) => {
const file = this.filesStore.files.find((item) => item.id == this.fileId);