also mark user online if they post a reply
v1.18.x
Barış Soner Uşaklı 10 years ago
parent f928b87997
commit 36942125e6

@ -56,9 +56,34 @@ define('forum/topic/posts', [
}
function removeAlreadyAddedPosts() {
data.posts = data.posts.filter(function(post) {
return components.get('post', 'pid', post.pid).length === 0;
});
var newPosts = components.get('topic').find('[data-index][data-index!="0"].new');
if (newPosts.length === data.posts.length) {
var allSamePids = true;
newPosts.each(function(index, el) {
if (parseInt($(el).attr('data-pid'), 10) !== parseInt(data.posts[index].pid, 10)) {
allSamePids = false;
}
});
if (allSamePids) {
newPosts.each(function() {
$(this).removeClass('new');
});
data.posts.length = 0;
return;
}
}
if (data.posts.length > 1) {
data.posts.forEach(function(post) {
components.get('post', 'pid', post.pid).remove();
});
} else {
data.posts = data.posts.filter(function(post) {
return components.get('post', 'pid', post.pid).length === 0;
});
}
}
var after = null,

@ -49,6 +49,8 @@ SocketPosts.reply = function(socket, data, callback) {
socket.emit('event:new_post', result);
user.updateOnlineUsers(socket.uid);
SocketPosts.notifyOnlineUsers(socket.uid, result);
if (data.lock) {

Loading…
Cancel
Save