diff --git a/public/src/forum/account.js b/public/src/forum/account.js index de9c7539fd..ae87fa4e1b 100644 --- a/public/src/forum/account.js +++ b/public/src/forum/account.js @@ -13,8 +13,11 @@ var editLink = $('#editLink'); var followBtn = $('#follow-btn'); - - if( yourid !== theirid) { + if(yourid === "0") { + editLink.hide(); + followBtn.hide(); + } + else if(yourid !== theirid) { editLink.hide(); if(isFollowing) followBtn.hide(); diff --git a/src/websockets.js b/src/websockets.js index 5d2c51abd9..0bb2ff4c0e 100644 --- a/src/websockets.js +++ b/src/websockets.js @@ -281,35 +281,37 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }), socket.on('api:user.follow', function(data) { - - user.follow(uid, data.uid, function(success) { - if(success) { - user.getUserField(data.uid, 'username', function(username) { - socket.emit('event:alert', { - title: 'Following', - message: 'You are now following ' + username + '!', - type: 'success', - timeout: 2000 - }); - }); - } - }); + if(uid) { + user.follow(uid, data.uid, function(success) { + if(success) { + user.getUserField(data.uid, 'username', function(username) { + socket.emit('event:alert', { + title: 'Following', + message: 'You are now following ' + username + '!', + type: 'success', + timeout: 2000 + }); + }); + } + }); + } }); socket.on('api:user.unfollow', function(data) { - - user.unfollow(uid, data.uid, function(success) { - if(success) { - user.getUserField(data.uid, 'username', function(username) { - socket.emit('event:alert', { - title: 'Unfollowed', - message: 'You are no longer following ' + username + '!', - type: 'success', - timeout: 2000 - }); - }); - } - }); + if(uid) { + user.unfollow(uid, data.uid, function(success) { + if(success) { + user.getUserField(data.uid, 'username', function(username) { + socket.emit('event:alert', { + title: 'Unfollowed', + message: 'You are no longer following ' + username + '!', + type: 'success', + timeout: 2000 + }); + }); + } + }); + } }); socket.on('api:topics.post', function(data) {