Commit f52a8fc7f8285d26e48eb202e00e82d5f5824f05

Authored by Antonio Terceiro
1 parent 86e1fd79

Fix Javascript error when chat is not enabled

Bail out from the callback in the case the "online friends" widget is
not present.

(ActionItem1708)
Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
public/javascripts/application.js
@@ -502,6 +502,9 @@ jQuery(function($) { @@ -502,6 +502,9 @@ jQuery(function($) {
502 } 502 }
503 503
504 function chatOnlineUsersDataCallBack(data) { 504 function chatOnlineUsersDataCallBack(data) {
  505 + if ($('#chat-online-users').length == 0) {
  506 + return;
  507 + }
505 var content = ''; 508 var content = '';
506 $('#chat-online-users').html($('#chat-online-users').html().replace(/%{amount}/g, data['amount_of_friends'])); 509 $('#chat-online-users').html($('#chat-online-users').html().replace(/%{amount}/g, data['amount_of_friends']));
507 $('#chat-online-users').fadeIn(); 510 $('#chat-online-users').fadeIn();