From 28690be77cd4e5f633c10a2b51faff656e3857c6 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 21 Jul 2018 12:42:00 -0700 Subject: [PATCH] Fixes #709 - Share links fail when logged into another Outline account --- app/models/Document.js | 2 +- app/scenes/Document/Document.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/Document.js b/app/models/Document.js index 0336d2f7..1359b702 100644 --- a/app/models/Document.js +++ b/app/models/Document.js @@ -66,7 +66,7 @@ class Document extends BaseModel { }); }; - if (this.collection.documents) { + if (this.collection && this.collection.documents) { traveler(this.collection.documents, []); if (path) return path; } diff --git a/app/scenes/Document/Document.js b/app/scenes/Document/Document.js index 3ba330e9..f5f194f1 100644 --- a/app/scenes/Document/Document.js +++ b/app/scenes/Document/Document.js @@ -110,9 +110,10 @@ class DocumentScene extends React.Component { text: '', }); } else { + const { shareId } = props.match.params; this.document = await this.props.documents.fetch( props.match.params.documentSlug, - { shareId: props.match.params.shareId } + { shareId } ); const document = this.document; @@ -123,7 +124,7 @@ class DocumentScene extends React.Component { // Cache data if user enters edit mode and cancels this.editCache = document.text; - if (this.props.auth.user) { + if (this.props.auth.user && !shareId) { if (!this.isEditing && document.publishedAt) { this.viewTimeout = setTimeout(document.view, MARK_AS_VIEWED_AFTER); }