This commit is contained in:
Baris Usakli
2013-09-03 13:11:34 -04:00
parent e9054301d1
commit a2af4a3e91
2 changed files with 8 additions and 2 deletions

View File

@@ -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);
})
});
}());

View File

@@ -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');