mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
topics and posts counters will update for everyone
This commit is contained in:
@@ -87,7 +87,7 @@ define(function() {
|
|||||||
function loadMoreTopics() {
|
function loadMoreTopics() {
|
||||||
loadingMoreTopics = true;
|
loadingMoreTopics = true;
|
||||||
socket.emit('api:topics.loadMoreUnreadTopics', {
|
socket.emit('api:topics.loadMoreUnreadTopics', {
|
||||||
after: parseInt($('#topics-container').attr('data-next-start'), 10);
|
after: parseInt($('#topics-container').attr('data-next-start'), 10)
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
if (data.topics && data.topics.length) {
|
if (data.topics && data.topics.length) {
|
||||||
onTopicsLoaded(data.topics);
|
onTopicsLoaded(data.topics);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ var RDB = require('./redis.js'),
|
|||||||
} else {
|
} else {
|
||||||
callback(posts);
|
callback(posts);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback([]);
|
callback([]);
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ var RDB = require('./redis.js'),
|
|||||||
data = data || {};
|
data = data || {};
|
||||||
data.pid = pid;
|
data.pid = pid;
|
||||||
data.field = field;
|
data.field = field;
|
||||||
|
|
||||||
plugins.fireHook('filter:post.getField', data, function(err, data) {
|
plugins.fireHook('filter:post.getField', data, function(err, data) {
|
||||||
callback(data);
|
callback(data);
|
||||||
});
|
});
|
||||||
@@ -464,7 +464,7 @@ var RDB = require('./redis.js'),
|
|||||||
posts: data[1] ? data[1] : 0
|
posts: data[1] ? data[1] : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
socket.emit('post.stats', stats);
|
io.sockets.emit('post.stats', stats);
|
||||||
} else
|
} else
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ module.exports.init = function(io) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('post.stats', function(data) {
|
socket.on('post.stats', function(data) {
|
||||||
posts.getTopicPostStats(socket);
|
posts.getTopicPostStats();
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('user.latest', function(data) {
|
socket.on('user.latest', function(data) {
|
||||||
@@ -373,7 +373,7 @@ module.exports.init = function(io) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
posts.getTopicPostStats(socket);
|
posts.getTopicPostStats();
|
||||||
|
|
||||||
socket.emit('event:alert', {
|
socket.emit('event:alert', {
|
||||||
title: 'Thank you for posting',
|
title: 'Thank you for posting',
|
||||||
@@ -426,7 +426,7 @@ module.exports.init = function(io) {
|
|||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
||||||
posts.getTopicPostStats(socket);
|
posts.getTopicPostStats();
|
||||||
|
|
||||||
socket.emit('event:alert', {
|
socket.emit('event:alert', {
|
||||||
title: 'Reply Successful',
|
title: 'Reply Successful',
|
||||||
@@ -476,7 +476,7 @@ module.exports.init = function(io) {
|
|||||||
socket.on('api:topic.delete', function(data) {
|
socket.on('api:topic.delete', function(data) {
|
||||||
threadTools.delete(data.tid, uid, function(err) {
|
threadTools.delete(data.tid, uid, function(err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
posts.getTopicPostStats(socket);
|
posts.getTopicPostStats();
|
||||||
socket.emit('api:topic.delete', {
|
socket.emit('api:topic.delete', {
|
||||||
status: 'ok',
|
status: 'ok',
|
||||||
tid: data.tid
|
tid: data.tid
|
||||||
@@ -487,7 +487,7 @@ module.exports.init = function(io) {
|
|||||||
|
|
||||||
socket.on('api:topic.restore', function(data) {
|
socket.on('api:topic.restore', function(data) {
|
||||||
threadTools.restore(data.tid, uid, socket, function(err) {
|
threadTools.restore(data.tid, uid, socket, function(err) {
|
||||||
posts.getTopicPostStats(socket);
|
posts.getTopicPostStats();
|
||||||
|
|
||||||
socket.emit('api:topic.restore', {
|
socket.emit('api:topic.restore', {
|
||||||
status: 'ok',
|
status: 'ok',
|
||||||
@@ -547,13 +547,13 @@ module.exports.init = function(io) {
|
|||||||
|
|
||||||
socket.on('api:posts.delete', function(data) {
|
socket.on('api:posts.delete', function(data) {
|
||||||
postTools.delete(uid, data.pid, function() {
|
postTools.delete(uid, data.pid, function() {
|
||||||
posts.getTopicPostStats(socket);
|
posts.getTopicPostStats();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('api:posts.restore', function(data) {
|
socket.on('api:posts.restore', function(data) {
|
||||||
postTools.restore(uid, data.pid, function() {
|
postTools.restore(uid, data.pid, function() {
|
||||||
posts.getTopicPostStats(socket);
|
posts.getTopicPostStats();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user