mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 17:35:46 +01:00
anons cant follow, hide follow button if not logged in
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user