mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 19:11:38 -05:00
fix voting code
This commit is contained in:
parent
e26fb593ea
commit
3f66f1f10c
2 changed files with 4 additions and 5 deletions
|
@ -23,7 +23,7 @@ function afterCommentOperations (comment) {
|
|||
|
||||
// increment comment count
|
||||
Meteor.users.update({_id: userId}, {
|
||||
$inc: {'commentCount': 1}
|
||||
$inc: {'telescope.commentCount': 1}
|
||||
});
|
||||
|
||||
// update post
|
||||
|
@ -37,7 +37,6 @@ function afterCommentOperations (comment) {
|
|||
Telescope.upvoteItem(Comments, comment, commentAuthor);
|
||||
|
||||
return comment;
|
||||
|
||||
};
|
||||
|
||||
Telescope.callbacks.register("commentSubmitAsync", afterCommentOperations);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// The default is found in base.js in the base package, and returns 1.
|
||||
|
||||
var modifyKarma = function (userId, karma) {
|
||||
Meteor.users.update({_id: userId}, {$inc: {karma: karma}});
|
||||
Meteor.users.update({_id: userId}, {$inc: {"telescope.karma": karma}});
|
||||
};
|
||||
|
||||
var hasUpvotedItem = function (item, user) {
|
||||
|
@ -16,7 +16,7 @@ var hasDownvotedItem = function (item, user) {
|
|||
};
|
||||
|
||||
var addVote = function (userId, vote, collection, upOrDown) {
|
||||
var field = 'votes.' + upOrDown + 'voted' + collection;
|
||||
var field = 'telescope.' + upOrDown + 'voted' + collection;
|
||||
var add = {};
|
||||
add[field] = vote;
|
||||
var result = Meteor.users.update({_id: userId}, {
|
||||
|
@ -25,7 +25,7 @@ var addVote = function (userId, vote, collection, upOrDown) {
|
|||
};
|
||||
|
||||
var removeVote = function (userId, itemId, collection, upOrDown) {
|
||||
var field = 'votes.' + upOrDown + 'voted' + collection;
|
||||
var field = 'telescope.' + upOrDown + 'voted' + collection;
|
||||
var remove = {};
|
||||
remove[field] = {itemId: itemId};
|
||||
Meteor.users.update({_id: userId}, {
|
||||
|
|
Loading…
Add table
Reference in a new issue