mirror of
https://github.com/vale981/Vulcan
synced 2025-03-09 12:16:37 -04:00
rename publication options
This commit is contained in:
parent
0643437c67
commit
2a46bb11e9
5 changed files with 10 additions and 10 deletions
|
@ -37,7 +37,7 @@ Meteor.publish('commentUsers', function(commentId) {
|
||||||
var post = Posts.findOne(comment.postId);
|
var post = Posts.findOne(comment.postId);
|
||||||
userIds.push(post.userId);
|
userIds.push(post.userId);
|
||||||
|
|
||||||
return Meteor.users.find({_id: {$in: userIds}}, {fields: Users.pubsub.privacyOptions});
|
return Meteor.users.find({_id: {$in: userIds}}, {fields: Users.pubsub.publicProperties});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ Meteor.publish('postsListUsers', function(terms) {
|
||||||
|
|
||||||
userIds = _.unique(userIds);
|
userIds = _.unique(userIds);
|
||||||
|
|
||||||
return Meteor.users.find({_id: {$in: userIds}}, {fields: Users.pubsub.avatarOptions, multi: true});
|
return Meteor.users.find({_id: {$in: userIds}}, {fields: Users.pubsub.avatarProperties, multi: true});
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
@ -74,7 +74,7 @@ Meteor.publish('postUsers', function(postId) {
|
||||||
// remove any duplicate IDs
|
// remove any duplicate IDs
|
||||||
users = _.unique(users);
|
users = _.unique(users);
|
||||||
|
|
||||||
return Meteor.users.find({_id: {$in: users}}, {fields: Users.pubsub.privacyOptions});
|
return Meteor.users.find({_id: {$in: users}}, {fields: Users.pubsub.publicProperties});
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,8 +2,8 @@ Meteor.publish('settings', function() {
|
||||||
var options = {};
|
var options = {};
|
||||||
var privateFields = {};
|
var privateFields = {};
|
||||||
|
|
||||||
// look at Settings.schema to see which fields should be kept private
|
// look at Settings.simpleSchema._schema to see which fields should be kept private
|
||||||
_.each(Settings.schema._schema, function (property, key) {
|
_.each(Settings.simpleSchema._schema, function (property, key) {
|
||||||
if (property.private)
|
if (property.private)
|
||||||
privateFields[key] = false;
|
privateFields[key] = false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@ Users.pubsub = {};
|
||||||
* Default user object fields in publication
|
* Default user object fields in publication
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Users.pubsub.privacyOptions = { // true means exposed
|
Users.pubsub.publicProperties = { // true means exposed
|
||||||
_id: true,
|
_id: true,
|
||||||
commentCount: true,
|
commentCount: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
|
@ -43,7 +43,7 @@ Users.pubsub.privacyOptions = { // true means exposed
|
||||||
* Options for your own user account (for security reasons, block certain properties)
|
* Options for your own user account (for security reasons, block certain properties)
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Users.pubsub.ownUserOptions = {
|
Users.pubsub.privateProperties = {
|
||||||
'services.password.bcrypt': false
|
'services.password.bcrypt': false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ Users.pubsub.ownUserOptions = {
|
||||||
* Minimum required properties to display avatars
|
* Minimum required properties to display avatars
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Users.pubsub.avatarOptions = {
|
Users.pubsub.avatarProperties = {
|
||||||
_id: true,
|
_id: true,
|
||||||
email_hash: true,
|
email_hash: true,
|
||||||
slug: true,
|
slug: true,
|
||||||
|
|
|
@ -3,7 +3,7 @@ Meteor.publish('singleUser', function(idOrSlug) {
|
||||||
var findById = Meteor.users.findOne(idOrSlug);
|
var findById = Meteor.users.findOne(idOrSlug);
|
||||||
var findBySlug = Meteor.users.findOne({slug: idOrSlug});
|
var findBySlug = Meteor.users.findOne({slug: idOrSlug});
|
||||||
var user = typeof findById !== 'undefined' ? findById : findBySlug;
|
var user = typeof findById !== 'undefined' ? findById : findBySlug;
|
||||||
var options = Users.isAdminById(this.userId) ? {} : {fields: Users.pubsub.privacyOptions};
|
var options = Users.isAdminById(this.userId) ? {} : {fields: Users.pubsub.publicProperties};
|
||||||
if (user) {
|
if (user) {
|
||||||
return Meteor.users.find({_id: user._id}, options);
|
return Meteor.users.find({_id: user._id}, options);
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ Meteor.publish('userComments', function(userId, limit) {
|
||||||
// Publish the current user
|
// Publish the current user
|
||||||
|
|
||||||
Meteor.publish('currentUser', function() {
|
Meteor.publish('currentUser', function() {
|
||||||
var user = Meteor.users.find({_id: this.userId}, {fields: Users.pubsub.ownUserOptions});
|
var user = Meteor.users.find({_id: this.userId}, {fields: Users.pubsub.privateProperties});
|
||||||
return user;
|
return user;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue