Public libraries no longer require login to view
This commit is contained in:
@@ -40,16 +40,23 @@ let libraryIdSchema = new SimpleSchema({
|
|||||||
Meteor.publish('library', function(libraryId){
|
Meteor.publish('library', function(libraryId){
|
||||||
libraryIdSchema.validate({libraryId});
|
libraryIdSchema.validate({libraryId});
|
||||||
this.autorun(function (){
|
this.autorun(function (){
|
||||||
if (!this.userId) return [];
|
let libraryCursor
|
||||||
let libraryCursor = Libraries.find({
|
if (this.userId) {
|
||||||
_id: libraryId,
|
libraryCursor = Libraries.find({
|
||||||
$or: [
|
_id: libraryId,
|
||||||
{owner: this.userId},
|
$or: [
|
||||||
{writers: this.userId},
|
{owner: this.userId},
|
||||||
{readers: this.userId},
|
{writers: this.userId},
|
||||||
{public: true},
|
{readers: this.userId},
|
||||||
],
|
{public: true},
|
||||||
});
|
],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
libraryCursor = Libraries.find({
|
||||||
|
_id: libraryId,
|
||||||
|
public: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
if (!libraryCursor.count()) return this.ready();
|
if (!libraryCursor.count()) return this.ready();
|
||||||
return [
|
return [
|
||||||
libraryCursor,
|
libraryCursor,
|
||||||
|
|||||||
Reference in New Issue
Block a user