don't need updateCategoryInPosts method anymore (fix #590)

This commit is contained in:
Sacha Greif 2014-12-04 11:27:40 +09:00
parent 2eb31e0647
commit 5b72a09c7d
2 changed files with 0 additions and 27 deletions

View file

@ -11,11 +11,6 @@ Meteor.startup(function () {
}else{
Categories.remove(categoryId);
}
Meteor.call('updateCategoryInPosts', categoryId, function(error) {
if (error) {
throwError(error.reason);
}
});
}
});
});

View file

@ -15,27 +15,5 @@ Meteor.methods({
giveInvites: function () {
if(isAdmin(Meteor.user()))
Meteor.users.update({}, {$inc:{inviteCount: 1}}, {multi:true});
},
updateCategoryInPosts: function (categoryId) {
check(categoryId, String);
if (!isAdmin(Meteor.user()))
throw new Meteor.Error(403, "Not an admin");
var category = Categories.findOne(categoryId);
if (!category) {
Posts.update(
{}
, {$pull: {categories: {_id: categoryId}}}
, {multi: true}
);
} else {
// Such update is server-only, because Minimongo does not support $ yet
Posts.update(
{'categories._id': categoryId}
, {$set: {'categories.$': category}}
, {multi: true}
);
}
}
});