Skip to content

Node.js based forum software built for the modern web

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

psychobunnycecd3fe96932
diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js
index f877870b1e..5c93e5f5a5 100644
--- a/public/src/forum/topic.js
+++ b/public/src/forum/topic.js
@@ -296,7 +296,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
set_follow_state = function(state, quiet) {
if (state && !followEl.hasClass('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) {
app.alert({
alert_id: 'topic_follow',
@@ -308,7 +308,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
}
} else if (!state && followEl.hasClass('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) {
app.alert({
alert_id: 'topic_follow',
@@ -325,23 +325,23 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
set_follow_state(state, true);
});
- if (followEl[0]) {
- followEl[0].addEventListener('click', function() {
- socket.emit('topics.follow', tid, function(err, state) {
- if(err) {
- return app.alert({
- type: 'danger',
- alert_id: 'topic_follow',
- title: 'Please Log In',
- message: 'Please register or log in in order to subscribe to this topic',
- timeout: 5000
- });
- }
+ followEl.on('click', function() {
+ socket.emit('topics.follow', tid, function(err, state) {
+ if(err) {
+ return app.alert({
+ type: 'danger',
+ alert_id: 'topic_follow',
+ title: 'Please Log In',
+ message: 'Please register or log in in order to subscribe to this topic',
+ timeout: 5000
+ });
+ }
- set_follow_state(state);
- });
- }, false);
- }
+ set_follow_state(state);
+ });
+
+ return false;
+ });
enableInfiniteLoading();
@@ -438,6 +438,8 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
pid: pid,
room_id: app.currentRoom
});
+
+ return false;
});
$('#post-container').on('click', '.flag', function() {