From 8b6f7012461310ff2e39b2fe118d5997ab57f474 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 21 Mar 2014 14:57:38 -0400 Subject: [PATCH] removd dupe --- src/favourites.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/favourites.js b/src/favourites.js index 2c164d1f28..67c52b8d8c 100644 --- a/src/favourites.js +++ b/src/favourites.js @@ -112,16 +112,18 @@ var async = require('async'), } Favourites.upvote = function(pid, room_id, uid, socket) { - Favourites.unvote(pid, room_id, uid, socket, function(err) { - vote('upvote', false, pid, room_id, uid, socket); - }); + toggleVote('upvote', pid, room_id, uid, socket); }; Favourites.downvote = function(pid, room_id, uid, socket) { + toggleVote('downvote', pid, room_id, uid, socket); + }; + + function toggleVote(type, pid, room_id, uid, socket) { Favourites.unvote(pid, room_id, uid, socket, function(err) { - vote('downvote', false, pid, room_id, uid, socket); + vote(type, false, pid, room_id, uid, socket); }); - }; + } Favourites.unvote = function(pid, room_id, uid, socket, callback) { var websockets = require('./socket.io'); @@ -247,7 +249,7 @@ var async = require('async'), Favourites.getFavouritedUidsByPids = function(pids, callback) { async.map(pids, function(pid, next) { db.getSetMembers('pid:' + pid + ':users_favourited', next); - }, callback) + }, callback); }; }(exports)); \ No newline at end of file