2014-09-03 09:56:38 +09:00
|
|
|
// Publish the current user
|
|
|
|
|
|
|
|
Meteor.publish('currentUser', function() {
|
2015-04-20 13:57:37 +09:00
|
|
|
var user = Meteor.users.find({_id: this.userId}, {fields: Users.pubsub.ownUserOptions});
|
2014-09-03 09:56:38 +09:00
|
|
|
return user;
|
|
|
|
});
|
|
|
|
|
|
|
|
// publish all users for admins to make autocomplete work
|
|
|
|
// TODO: find a better way
|
|
|
|
|
|
|
|
Meteor.publish('allUsersAdmin', function() {
|
2015-03-28 18:30:26 +09:00
|
|
|
var selector = Settings.get('requirePostInvite') ? {isInvited: true} : {}; // only users that can post
|
2015-04-20 13:57:37 +09:00
|
|
|
if (Users.isAdminById(this.userId)) {
|
2014-09-03 09:56:38 +09:00
|
|
|
return Meteor.users.find(selector, {fields: {
|
|
|
|
_id: true,
|
|
|
|
profile: true,
|
|
|
|
slug: true
|
|
|
|
}});
|
|
|
|
}
|
|
|
|
return [];
|
|
|
|
});
|