From bcd6e17781e8a6fa4f5d896040d391f7cb8932f4 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 27 Jan 2022 17:14:36 -0800 Subject: [PATCH] fix: Cannot view history with view-only permissions and collab editing enabled (#3024) closes #3016 --- app/scenes/Document/components/DataLoader.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/scenes/Document/components/DataLoader.tsx b/app/scenes/Document/components/DataLoader.tsx index e8ebb2d46..3899928ef 100644 --- a/app/scenes/Document/components/DataLoader.tsx +++ b/app/scenes/Document/components/DataLoader.tsx @@ -92,11 +92,12 @@ class DataLoader extends React.Component { } } + get isEditRoute() { + return this.props.match.path === matchDocumentEdit; + } + get isEditing() { - return ( - this.props.match.path === matchDocumentEdit || - this.props.auth?.team?.collaborativeEditing - ); + return this.isEditRoute || this.props.auth?.team?.collaborativeEditing; } onSearchLink = async (term: string) => { @@ -208,7 +209,7 @@ class DataLoader extends React.Component { // If we're attempting to update an archived, deleted, or otherwise // uneditable document then forward to the canonical read url. - if (!can.update && this.isEditing) { + if (!can.update && this.isEditRoute) { history.push(document.url); return; }