X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2FpageMinichat%2Fconversations.js;h=26fbb66ebd299e0263b4997cd76082a58d6398b6;hp=ada8a24382bc09f8cf3c20e5b0cea8ebedf7bf17;hb=d8ea5d4c3a3ed6e596a473bbb8a4df0a41b4843a;hpb=217c4d7a0d5f9fee3a8ef0a05ab8506c7f39d5e5 diff --git a/js/pageMinichat/conversations.js b/js/pageMinichat/conversations.js index ada8a24..26fbb66 100644 --- a/js/pageMinichat/conversations.js +++ b/js/pageMinichat/conversations.js @@ -218,9 +218,14 @@ euphorik.Conversations.prototype.ajouterMessages = function(elements, numConvers if (!elements.messages.length) { return this.conversations[numConversation] !== undefined; } - + for (var i = 0; i < elements.messages.length; i++) { - this.ajouterMessage(elements.messages[i], numConversation) + if (this.ajouterMessage(elements.messages[i], numConversation)) { + // si une nouvelle conversation a été créée alors on lui donne la racine + // TODO : ce block ne devrait pas se trouver ici mais dans "nouvelleConversation" + this.conversations[numConversation].setRacine(elements.first); + this.mettreAJourFragment(); + } } this.flush(numConversation); @@ -257,7 +262,6 @@ euphorik.Conversations.prototype.ajouterMessage = function(element, numConversat nouvelleConversation = true; this.nouvelleConversation( numConversation, - message, // si une nouvelle conversation a été créée alors on lui donne la racine qui correspond au premier message function(num) { // fermeture de la conversation thisConversations.supprimerConversation(num); }, @@ -274,17 +278,12 @@ euphorik.Conversations.prototype.ajouterMessage = function(element, numConversat return nouvelleConversation; }; -euphorik.Conversations.prototype.nouvelleConversation = function(num, racine, funFermer, funLien) +euphorik.Conversations.prototype.nouvelleConversation = function(num, funFermer, funLien) { var thisMessages = this; this.conversations[num] = new euphorik.Conversation(this, num); - - if (racine) { - this.conversations[num].racine = racine; - this.mettreAJourFragment(); - } - + if (funFermer) { this.conversations[num].eventFermer(funFermer); }