mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
fixing bug where an anonymous user could follow a topic... yikes
This commit is contained in:
@@ -189,7 +189,16 @@
|
||||
set_follow_state(state, true);
|
||||
});
|
||||
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);
|
||||
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) {
|
||||
if (uid && uid > 0) {
|
||||
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'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user