fixing bug where an anonymous user could follow a topic... yikes

v1.18.x
Julian Lam 12 years ago
parent a01a5bbd64
commit 2914496799

@ -189,7 +189,16 @@
set_follow_state(state, true); set_follow_state(state, true);
}); });
socket.on('api:topic.follow', function(data) { socket.on('api:topic.follow', function(data) {
set_follow_state(data.follow); if (data.status && data.status === 'ok') set_follow_state(data.follow);
else {
app.alert({
type: 'error',
alert_id: 'topic_follow',
title: 'Please Log In',
message: 'Please register or log in in order to subscribe to this topic',
timeout: 5000
});
}
}); });
socket.emit('api:topic.followCheck', tid); socket.emit('api:topic.followCheck', tid);
followEl[0].addEventListener('click', function() { followEl[0].addEventListener('click', function() {

@ -378,9 +378,16 @@ var SocketIO = require('socket.io').listen(global.server, { log:false }),
}); });
socket.on('api:topic.follow', function(tid) { socket.on('api:topic.follow', function(tid) {
threadTools.toggleFollow(tid, uid, function(follow) { if (uid && uid > 0) {
if (follow.status === 'ok') socket.emit('api:topic.follow', follow); threadTools.toggleFollow(tid, uid, function(follow) {
}); if (follow.status === 'ok') socket.emit('api:topic.follow', follow);
});
} else {
socket.emit('api:topic.follow', {
status: 'error',
error: 'not-logged-in'
});
}
}); });
}); });

Loading…
Cancel
Save