mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 12:01:17 +01:00
Merge remote-tracking branch 'origin/master' into categories_revamp
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user