fix: Document history menu item should toggle history sidebar

This commit is contained in:
Tom Moor 2019-10-15 21:42:07 -07:00
parent 5263d8a315
commit 66197a967a
3 changed files with 11 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import AuthStore from 'stores/AuthStore';
import CollectionStore from 'stores/CollectionsStore';
import PoliciesStore from 'stores/PoliciesStore';
import {
documentUrl,
documentMoveUrl,
documentEditUrl,
documentHistoryUrl,
@ -25,6 +26,7 @@ type Props = {
collections: CollectionStore,
policies: PoliciesStore,
className: string,
isRevision?: boolean,
showPrint?: boolean,
showToggleEmbeds?: boolean,
showPin?: boolean,
@ -51,7 +53,11 @@ class DocumentMenu extends React.Component<Props> {
};
handleDocumentHistory = () => {
this.redirectTo = documentHistoryUrl(this.props.document);
if (this.props.isRevision) {
this.redirectTo = documentUrl(this.props.document);
} else {
this.redirectTo = documentHistoryUrl(this.props.document);
}
};
handleMove = (ev: SyntheticEvent<>) => {

View File

@ -378,6 +378,7 @@ class DocumentScene extends React.Component<Props> {
{!isShare && (
<Header
document={document}
isRevision={!!revision}
isDraft={document.isDraft}
isEditing={this.isEditing}
isSaving={this.isSaving}

View File

@ -32,6 +32,7 @@ type Props = {
document: Document,
isDraft: boolean,
isEditing: boolean,
isRevision: boolean,
isSaving: boolean,
isPublishing: boolean,
publishingIsDisabled: boolean,
@ -103,6 +104,7 @@ class Header extends React.Component<Props> {
isEditing,
isDraft,
isPublishing,
isRevision,
isSaving,
savingIsDisabled,
publishingIsDisabled,
@ -243,6 +245,7 @@ class Header extends React.Component<Props> {
<Action>
<DocumentMenu
document={document}
isRevision={isRevision}
showToggleEmbeds={canToggleEmbeds}
showPrint
/>