Fixes #709 - Share links fail when logged into another Outline account

This commit is contained in:
Tom Moor 2018-07-21 12:42:00 -07:00
parent 03411ead09
commit 28690be77c
2 changed files with 4 additions and 3 deletions

View File

@ -66,7 +66,7 @@ class Document extends BaseModel {
}); });
}; };
if (this.collection.documents) { if (this.collection && this.collection.documents) {
traveler(this.collection.documents, []); traveler(this.collection.documents, []);
if (path) return path; if (path) return path;
} }

View File

@ -110,9 +110,10 @@ class DocumentScene extends React.Component<Props> {
text: '', text: '',
}); });
} else { } else {
const { shareId } = props.match.params;
this.document = await this.props.documents.fetch( this.document = await this.props.documents.fetch(
props.match.params.documentSlug, props.match.params.documentSlug,
{ shareId: props.match.params.shareId } { shareId }
); );
const document = this.document; const document = this.document;
@ -123,7 +124,7 @@ class DocumentScene extends React.Component<Props> {
// Cache data if user enters edit mode and cancels // Cache data if user enters edit mode and cancels
this.editCache = document.text; this.editCache = document.text;
if (this.props.auth.user) { if (this.props.auth.user && !shareId) {
if (!this.isEditing && document.publishedAt) { if (!this.isEditing && document.publishedAt) {
this.viewTimeout = setTimeout(document.view, MARK_AS_VIEWED_AFTER); this.viewTimeout = setTimeout(document.view, MARK_AS_VIEWED_AFTER);
} }