Commit 445b9833e90a8d9c92cfcd9b2e8f17d881c46e05
Exists in
master
and in
27 other branches
Merge branch 'fix_javascript_bug' into 'master'
Fix javascript bug The refactoring of this commit 64d0ae2868654ad922dea3ae23ad3ad7a0421903 was causing the user to be logged out after trying to change his homepage. See merge request !414
Showing
1 changed file
with
3 additions
and
5 deletions
Show diff stats
public/javascripts/application.js
@@ -523,8 +523,10 @@ function userDataCallback(data) { | @@ -523,8 +523,10 @@ function userDataCallback(data) { | ||
523 | if (data.login) { | 523 | if (data.login) { |
524 | // logged in | 524 | // logged in |
525 | if (data.chat_enabled) { | 525 | if (data.chat_enabled) { |
526 | - setInterval(function(){ $.getJSON(user_data, chatOnlineUsersDataCallBack)}, 10000); | 526 | + setInterval(function(){ jQuery.getJSON(user_data, chatOnlineUsersDataCallBack)}, 10000); |
527 | } | 527 | } |
528 | + jQuery('head').append('<meta content="authenticity_token" name="csrf-param" />'); | ||
529 | + jQuery('head').append('<meta content="'+jQuery.cookie("_noosfero_.XSRF-TOKEN")+'" name="csrf-token" />'); | ||
528 | } | 530 | } |
529 | if (data.notice) { | 531 | if (data.notice) { |
530 | display_notice(data.notice); | 532 | display_notice(data.notice); |
@@ -546,10 +548,6 @@ jQuery(function($) { | @@ -546,10 +548,6 @@ jQuery(function($) { | ||
546 | 548 | ||
547 | var user_data = noosfero_root() + '/account/user_data'; | 549 | var user_data = noosfero_root() + '/account/user_data'; |
548 | $.getJSON(user_data, userDataCallback) | 550 | $.getJSON(user_data, userDataCallback) |
549 | - if (user_data.login) { | ||
550 | - $('head').append('<meta content="authenticity_token" name="csrf-param" />'); | ||
551 | - $('head').append('<meta content="'+$.cookie("_noosfero_.XSRF-TOKEN")+'" name="csrf-token" />'); | ||
552 | - } | ||
553 | 551 | ||
554 | $.ajaxSetup({ cache: false }); | 552 | $.ajaxSetup({ cache: false }); |
555 | 553 |