Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 11 years ago
commit 41116bc0b2

@ -1,8 +1,24 @@
'use strict';
define(function() {
var home = {};
home.init = function() {
app.enterRoom('home');
ajaxify.register_events([
'event:new_topic',
'event:new_post'
]);
socket.on('event:new_topic', function(data) {
});
socket.on('event:new_post', function(data) {
});
}
return home;

@ -70,9 +70,12 @@ SocketPosts.reply = function(socket, data, callback) {
var socketData = {
posts: [postData]
};
index.server.sockets.in('topic_' + postData.tid).emit('event:new_post', socketData);
index.server.sockets.in('recent_posts').emit('event:new_post', socketData);
index.server.sockets.in('user/' + postData.uid).emit('event:new_post', socketData);
var rooms = ['recent_posts', 'home', 'topic_' + postData.tid, 'user/' + postData.uid];
rooms.forEach(function(room) {
index.server.sockets.in(room).emit('event:new_post', socketData);
});
callback();
}
});

@ -57,8 +57,10 @@ SocketTopics.post = function(socket, data, callback) {
}
if (result) {
index.server.sockets.in('category_' + data.category_id).emit('event:new_topic', result.topicData);
index.server.sockets.in('recent_posts').emit('event:new_topic', result.topicData);
index.server.sockets.in('home').emit('event:new_topic', result.topicData);
index.server.sockets.in('user/' + socket.uid).emit('event:new_post', {
posts: result.postData
});

Loading…
Cancel
Save