X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2FpageMinichat%2Fconversations.js;h=b0eea99a97211fdebe06a4ba31ac111f9cb6ea6a;hp=2d5df0c5614a8f7ab785c1f327bad26f1ee1d225;hb=f2eb4c4ec53b164804c0c7441830372358ce74e6;hpb=ed281cb4331777625994d23a6e424fb7c5b5d2c9 diff --git a/js/pageMinichat/conversations.js b/js/pageMinichat/conversations.js index 2d5df0c..b0eea99 100644 --- a/js/pageMinichat/conversations.js +++ b/js/pageMinichat/conversations.js @@ -93,12 +93,12 @@ euphorik.Conversations.prototype.ajouterMessageRepond = function(mess) { var mess2; for (mess2 in this.messagesRepond) { if (this.messagesRepond.hasOwnProperty(mess2)) { + mess2 = this.messagesRepond[mess2]; break; } } - mess2 = this.messagesRepond[mess2]; - if (mess2 && mess2.racineId == mess.racineId) { + if (mess2 && mess2.racineId !== mess.racineId) { this.util.messageDialogue("Impossible de répondre à deux messages ne faisant pas partie de la même conversation"); return; } @@ -182,13 +182,14 @@ euphorik.Conversations.prototype.getJSONrafraichirMessages = function() { }; euphorik.Conversations.prototype.getJSONConversations = function() { + var thisConversations = this var clientConv = []; this.client.conversations.each(function(i, conv) { clientConv.push({ root : conv.root, page : conv.page, - last_message_id : this.conversations[i + 1] ? this.conversations[i + 1].idDernierMessageAffiche : 0 + last_message_id : thisConversations.conversations[i + 1] ? thisConversations.conversations[i + 1].idDernierMessageAffiche : 0 }); }); return clientConv; @@ -231,9 +232,8 @@ euphorik.Conversations.prototype.ajouterMessages = function(elements, numConvers * @return true si une nouvelle conversation a été créée sinon false */ euphorik.Conversations.prototype.ajouterMessage = function(element, numConversation) { - var thisMessages = this; - - // pas d'utilisation de jquery pour des raisons de performance + var thisConversations = this; + var message = new euphorik.Message( this.client, @@ -248,12 +248,12 @@ euphorik.Conversations.prototype.ajouterMessage = function(element, numConversat this.nouvelleConversation( numConversation, function(num) { // fermeture de la conversation - thisMessages.supprimerConversation(num); + thisConversations.supprimerConversation(num); }, function(num) { // insertion du lien vers la conversation thisPage.util.replaceSelection( $("form#posterMessage input.message")[0], - "{" + thisMessages.client.conversations[num-1].root.toString(36) + "}" + "{" + thisConversations.client.conversations[num-1].root.toString(36) + "}" ); } );