This commit is contained in:
Baris Soner Usakli
2014-03-03 15:26:15 -05:00
parent 529cd60dd2
commit be70b3de57
4 changed files with 32 additions and 23 deletions

View File

@@ -1,3 +1,6 @@
'use strict';
var topics = require('../topics'),
categories = require('../categories'),
threadTools = require('../threadTools'),
@@ -68,7 +71,7 @@ SocketTopics.post = function(socket, data, callback) {
type: 'success',
timeout: 2000
});
callback(null);
callback();
}
});
};
@@ -88,14 +91,19 @@ SocketTopics.markAsRead = function(socket, data) {
};
SocketTopics.markAllRead = function(socket, data, callback) {
topics.markAllRead(socket.uid, function(err) {
if (!Array.isArray(data)) {
return callback(new Error('invalid-data'));
}
topics.markAllRead(socket.uid, data, function(err) {
if(err) {
return callback(err);
}
index.server.sockets.in('uid_' + socket.uid).emit('event:unread.updateCount', null, []);
callback(null);
callback();
});
};