rename getParameters to getPostParameters

This commit is contained in:
Delgermurun 2014-09-29 15:42:35 +08:00
parent 5d4805c137
commit 0ff3fc7dba
5 changed files with 12 additions and 12 deletions

View file

@ -1,6 +1,6 @@
// getParameters gives an object containing the appropriate find and options arguments for the subscriptions's Posts.find()
// getPostsParameters gives an object containing the appropriate find and options arguments for the subscriptions's Posts.find()
getParameters = function (terms) {
getPostsParameters = function (terms) {
// console.log(terms)
@ -69,4 +69,4 @@ getUsersParameters = function(filterBy, sortBy, limit) {
find: find,
options: {sort: sort, limit: limit}
};
};
};

View file

@ -310,7 +310,7 @@ PostsListController = FastRender.RouteController.extend({
this._terms.query = Session.get("searchQuery");
}
var parameters = getParameters(this._terms),
var parameters = getPostsParameters(this._terms),
postsCount = Posts.find(parameters.find, parameters.options).count();
parameters.find.createdAt = { $lte: Session.get('listPopulatedAt') };
@ -374,7 +374,7 @@ PostsDigestController = FastRender.RouteController.extend({
after: moment(currentDate).startOf('day').toDate(),
before: moment(currentDate).endOf('day').toDate()
},
parameters = getParameters(terms);
parameters = getPostsParameters(terms);
Session.set('currentDate', currentDate);
parameters.find.createdAt = { $lte: Session.get('listPopulatedAt') };

View file

@ -6,7 +6,7 @@ var getPosts = function (date) {
after: moment(date).startOf('day').toDate(),
before: moment(date).endOf('day').toDate()
};
var parameters = getParameters(terms);
var parameters = getPostsParameters(terms);
var posts = Posts.find(parameters.find, parameters.options).map(function (post, index, cursor) {
post.rank = index;
return post;
@ -43,4 +43,4 @@ Meteor.startup(function () {
}
});
});
});

View file

@ -12,7 +12,7 @@ getCampaignPosts = function (postsCount) {
var lastWeek = moment().subtract(7, 'days').toDate();
var after = (typeof lastCampaign != 'undefined') ? lastCampaign.finishedAt : lastWeek
var params = getParameters({
var params = getPostsParameters({
view: 'campaign',
limit: postsCount,
after: after
@ -83,4 +83,4 @@ Meteor.methods({
if(isAdminById(this.userId))
scheduleNextCampaign(true);
}
});
});

View file

@ -2,7 +2,7 @@
Meteor.publish('postsList', function(terms) {
if(canViewById(this.userId)){
var parameters = getParameters(terms),
var parameters = getPostsParameters(terms),
posts = Posts.find(parameters.find, parameters.options);
// console.log('//-------- Subscription Parameters:');
@ -20,10 +20,10 @@ Meteor.publish('postsList', function(terms) {
Meteor.publish('postsListUsers', function(terms) {
if(canViewById(this.userId)){
var parameters = getParameters(terms),
var parameters = getPostsParameters(terms),
posts = Posts.find(parameters.find, parameters.options),
userIds = _.pluck(posts.fetch(), 'userId');
return Meteor.users.find({_id: {$in: userIds}}, {fields: privacyOptions, multi: true});
}
return [];
});
});