anons cant follow, hide follow button if not logged in

v1.18.x
Baris Soner Usakli 12 years ago
parent bf6a38904a
commit e7c9079449

@ -13,8 +13,11 @@
var editLink = $('#editLink'); var editLink = $('#editLink');
var followBtn = $('#follow-btn'); var followBtn = $('#follow-btn');
if(yourid === "0") {
if( yourid !== theirid) { editLink.hide();
followBtn.hide();
}
else if(yourid !== theirid) {
editLink.hide(); editLink.hide();
if(isFollowing) if(isFollowing)
followBtn.hide(); followBtn.hide();

@ -281,35 +281,37 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
socket.on('api:user.follow', function(data) { socket.on('api:user.follow', function(data) {
if(uid) {
user.follow(uid, data.uid, function(success) { user.follow(uid, data.uid, function(success) {
if(success) { if(success) {
user.getUserField(data.uid, 'username', function(username) { user.getUserField(data.uid, 'username', function(username) {
socket.emit('event:alert', { socket.emit('event:alert', {
title: 'Following', title: 'Following',
message: 'You are now following ' + username + '!', message: 'You are now following ' + username + '!',
type: 'success', type: 'success',
timeout: 2000 timeout: 2000
});
}); });
}); }
} });
}); }
}); });
socket.on('api:user.unfollow', function(data) { socket.on('api:user.unfollow', function(data) {
if(uid) {
user.unfollow(uid, data.uid, function(success) { user.unfollow(uid, data.uid, function(success) {
if(success) { if(success) {
user.getUserField(data.uid, 'username', function(username) { user.getUserField(data.uid, 'username', function(username) {
socket.emit('event:alert', { socket.emit('event:alert', {
title: 'Unfollowed', title: 'Unfollowed',
message: 'You are no longer following ' + username + '!', message: 'You are no longer following ' + username + '!',
type: 'success', type: 'success',
timeout: 2000 timeout: 2000
});
}); });
}); }
} });
}); }
}); });
socket.on('api:topics.post', function(data) { socket.on('api:topics.post', function(data) {

Loading…
Cancel
Save