favourite changes

favourites.js no longer makes socket calls, moved that code into
socket.io/posts.js. it also makes a single socket call when you downvote
a post that you previously upvoted.
This commit is contained in:
barisusakli
2014-04-09 20:55:49 -04:00
parent e7f16e2b17
commit 95972209f4
6 changed files with 182 additions and 223 deletions

View File

@@ -111,6 +111,10 @@ define(['composer', 'share'], function(composer, share) {
socket.emit(method, {
pid: pid,
room_id: app.currentRoom
}, function(err) {
if (err) {
app.alertError(err.message);
}
});
return false;
@@ -123,6 +127,10 @@ define(['composer', 'share'], function(composer, share) {
socket.emit(currentState ? 'posts.unvote' : method , {
pid: post.attr('data-pid'),
room_id: app.currentRoom
}, function(err) {
if (err) {
app.alertError(err.message);
}
});
return false;