add last minute tweaks found while writing docs

This commit is contained in:
cleverbeagle 2017-06-13 08:12:26 -05:00
parent ab22ebc967
commit 3bc98bc3a6
15 changed files with 45 additions and 15 deletions

View file

@ -9,9 +9,5 @@ Meteor.publish('documents', function documents() {
// Note: documents.view is also used when editing an existing document.
Meteor.publish('documents.view', function documentsView(documentId) {
check(documentId, String);
const doc = Documents.find(documentId);
const isOwner = doc.fetch()[0].owner === this.userId;
return isOwner ? doc : this.ready();
return Documents.find({ _id: documentId, owner: this.userId });
});