adding return false to favouriting and following. using jq for follow code

v1.18.x
psychobunny 11 years ago
parent 5c957e8f8b
commit cecd3fe969

@ -296,7 +296,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
set_follow_state = function(state, quiet) { set_follow_state = function(state, quiet) {
if (state && !followEl.hasClass('btn-success')) { if (state && !followEl.hasClass('btn-success')) {
followEl.addClass('btn-success'); followEl.addClass('btn-success');
followEl[0].title = 'You are currently receiving updates to this topic'; followEl.attr('title', 'You are currently receiving updates to this topic');
if (!quiet) { if (!quiet) {
app.alert({ app.alert({
alert_id: 'topic_follow', alert_id: 'topic_follow',
@ -308,7 +308,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
} }
} else if (!state && followEl.hasClass('btn-success')) { } else if (!state && followEl.hasClass('btn-success')) {
followEl.removeClass('btn-success'); followEl.removeClass('btn-success');
followEl[0].title = 'Be notified of new replies in this topic'; followEl.attr('title', 'Be notified of new replies in this topic');
if (!quiet) { if (!quiet) {
app.alert({ app.alert({
alert_id: 'topic_follow', alert_id: 'topic_follow',
@ -325,23 +325,23 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
set_follow_state(state, true); set_follow_state(state, true);
}); });
if (followEl[0]) { followEl.on('click', function() {
followEl[0].addEventListener('click', function() { socket.emit('topics.follow', tid, function(err, state) {
socket.emit('topics.follow', tid, function(err, state) { if(err) {
if(err) { return app.alert({
return app.alert({ type: 'danger',
type: 'danger', alert_id: 'topic_follow',
alert_id: 'topic_follow', title: 'Please Log In',
title: 'Please Log In', message: 'Please register or log in in order to subscribe to this topic',
message: 'Please register or log in in order to subscribe to this topic', timeout: 5000
timeout: 5000 });
}); }
}
set_follow_state(state); set_follow_state(state);
}); });
}, false);
} return false;
});
enableInfiniteLoading(); enableInfiniteLoading();
@ -438,6 +438,8 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
pid: pid, pid: pid,
room_id: app.currentRoom room_id: app.currentRoom
}); });
return false;
}); });
$('#post-container').on('click', '.flag', function() { $('#post-container').on('click', '.flag', function() {

Loading…
Cancel
Save