Commit 607decd29775f87bbc6576671571f0bff5227a07

Authored by Rodrigo Souto
1 parent 032a2ee6

Add default value for offset

Showing 1 changed file with 2 additions and 1 deletions   Show diff stats
public/javascripts/chat.js
@@ -117,6 +117,7 @@ jQuery(function($) { @@ -117,6 +117,7 @@ jQuery(function($) {
117 }, 117 },
118 118
119 show_message: function (jid, name, body, who, identifier, time, offset) { 119 show_message: function (jid, name, body, who, identifier, time, offset) {
  120 + if(!offset) offset = 0;
120 if (body) { 121 if (body) {
121 body = Jabber.render_body_message(body); 122 body = Jabber.render_body_message(body);
122 var jid_id = Jabber.jid_to_id(jid); 123 var jid_id = Jabber.jid_to_id(jid);
@@ -124,7 +125,7 @@ jQuery(function($) { @@ -124,7 +125,7 @@ jQuery(function($) {
124 var history = $(tab_id).find('.history'); 125 var history = $(tab_id).find('.history');
125 126
126 var offset_container = $('#chat-offset-container-'+offset); 127 var offset_container = $('#chat-offset-container-'+offset);
127 - if(offset_container.length == 0) 128 + if(offset_container.length == 0)
128 offset_container = $('<div id="chat-offset-container-'+offset+'"></div>').prependTo(history); 129 offset_container = $('<div id="chat-offset-container-'+offset+'"></div>').prependTo(history);
129 130
130 if (offset_container.find('.message:last').attr('data-who') == who) { 131 if (offset_container.find('.message:last').attr('data-who') == who) {