inf scroll in chat-content

This commit is contained in:
barisusakli
2016-09-20 16:58:50 +03:00
parent 6c7fe6b5cf
commit 55396ca442
4 changed files with 82 additions and 10 deletions

View File

@@ -316,6 +316,28 @@ SocketModules.chats.hasPrivateChat = function(socket, uid, callback) {
Messaging.hasPrivateChat(socket.uid, uid, callback);
};
SocketModules.chats.getMessages = function(socket, data, callback) {
if (!socket.uid || !data.uid || !data.roomId) {
return callback(new Error('[[error:invalid-data]]'));
}
var params = {
uid: data.uid,
roomId: data.roomId,
start: parseInt(data.start, 10) + 1,
count: 50,
markRead: false
};
if (socket.uid === parseInt(data.uid, 10)) {
return Messaging.getMessages(params, callback);
}
user.isAdminOrGlobalMod(socket.uid, function(err, isAdminOrGlobalMod) {
if (err || !isAdminOrGlobalMod) {
return callback(err || new Error('[[error:no-privileges]]'));
}
Messaging.getMessages(params, callback);
});
};
/* Sounds */
SocketModules.sounds.getSounds = function(socket, data, callback) {
// Read sounds from local directory