Skip to content

Node.js based forum software built for the modern web

closes #220

Baris Usaklia2af4a3e914e
diff --git a/public/src/forum/account.js b/public/src/forum/account.js
index 516d9196f3..c93d6a5765 100644
--- a/public/src/forum/account.js
+++ b/public/src/forum/account.js
@@ -4,6 +4,8 @@
isFollowing = templates.get('isFollowing');
$(document).ready(function() {
+ var username = $('.account-username a').html();
+ app.enter_room('users/' + theirid);
app.addCommasToNumbers();
@@ -25,7 +27,6 @@
followBtn.on('click', function() {
socket.emit('api:user.follow', {uid: theirid}, function(success) {
- var username = $('.account-username a').html();
if(success) {
followBtn.hide();
unfollowBtn.show();
@@ -39,7 +40,6 @@
unfollowBtn.on('click', function() {
socket.emit('api:user.unfollow', {uid: theirid}, function(success) {
- var username = $('.account-username a').html();
if(success) {
followBtn.show();
unfollowBtn.hide();
@@ -71,6 +71,11 @@
socket.emit('api:user.isOnline', theirid, handleUserOnline);
+ socket.on('event:new_post', function(data) {
+ var html = templates.prepare(templates['account'].blocks['posts']).parse(data);
+ $('.user-recent-posts').prepend(html);
+ })
+
});
}());
\ No newline at end of file
diff --git a/src/posts.js b/src/posts.js
index ac127bc57c..037e356df0 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -259,6 +259,7 @@ var RDB = require('./redis.js'),
var socketData = { posts: [postData] };
io.sockets.in('topic_' + tid).emit('event:new_post', socketData);
io.sockets.in('recent_posts').emit('event:new_post', socketData);
+ io.sockets.in('users/' + uid).emit('event:new_post', socketData);
});
callback(null, 'Reply successful');