Commit 445b9833e90a8d9c92cfcd9b2e8f17d881c46e05

Authored by Antonio Terceiro
2 parents 2917f48f b4a1f3b9

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 523 if (data.login) {
524 524 // logged in
525 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 531 if (data.notice) {
530 532 display_notice(data.notice);
... ... @@ -546,10 +548,6 @@ jQuery(function($) {
546 548  
547 549 var user_data = noosfero_root() + '/account/user_data';
548 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 552 $.ajaxSetup({ cache: false });
555 553  
... ...