publish all users to make autocomplete work, but only for admins

This commit is contained in:
Sacha Greif 2013-11-08 11:38:57 +09:00
parent e18c5bbc0f
commit 8c7ba04589
2 changed files with 10 additions and 2 deletions

View file

@ -28,8 +28,8 @@ Meteor.subscribe('categories');
// Meteor doesn't send all the user properties that we need
Meteor.subscribe('currentUser');
// Subscribe to all users for now to make user selection autocomplete work?
// Meteor.subscribe('allUsers', {}, {});
// Subscribe to all users for now to make user selection autocomplete work
Meteor.subscribe('allUsersAdmin');
// Notifications - only load if user is logged in
if(Meteor.user() != null)

View file

@ -77,6 +77,14 @@ Meteor.publish('allUsers', function(find, options) {
}
});
// publish all users for admins to make autocomplete work
// TODO: find a better way
Meteor.publish('allUsersAdmin', function() {
if (isAdminById(this.userId))
return Meteor.users.find();
});
// -------------------------------------------- Posts -------------------------------------------- //
// Publish a single post