Bug 799068 - Land in comm-central Instantbird's changes to chat/ - 3 - Bio 1616 - Unread ruler in split bubble just before an action message hides the sender name, r=fqueze.
authoraleth <aletheia2@fastmail.fm>
Fri, 03 Aug 2012 20:02:45 +0200
changeset 13839 d8163dea2a0493649b7c4be669bd9bf1b0e5d813
parent 13838 5db319a1956e5a93ce8857f760227687779896f9
child 13840 74017bd357467fae251a87e2cad731d008d1b77d
push id762
push userbugzilla@standard8.plus.com
push dateMon, 19 Nov 2012 21:16:42 +0000
treeherdercomm-beta@4a2f61509b17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfqueze
bugs799068
Bug 799068 - Land in comm-central Instantbird's changes to chat/ - 3 - Bio 1616 - Unread ruler in split bubble just before an action message hides the sender name, r=fqueze.
chat/modules/imThemes.jsm
--- a/chat/modules/imThemes.jsm
+++ b/chat/modules/imThemes.jsm
@@ -487,17 +487,21 @@ function getHTMLForMessage(aMsg, aTheme,
   else {
     html = aMsg.incoming ? "incoming" : "outgoing";
     if (aIsNext)
       html += "Next";
     html += aIsContext ? "Context" : "Content";
     html = aTheme.html[html];
     replacements = messageReplacements;
     let meRegExp = /^((<[^>]+>)*)\/me /;
-    if (meRegExp.test(aMsg.message)) {
+    // We must test originalMessage here as aMsg.message loses its /me
+    // in the following, so if getHTMLForMessage is called a second time for
+    // the same aMsg (e.g. because it follows the unread ruler), the test
+    // would fail otherwise.
+    if (meRegExp.test(aMsg.originalMessage)) {
       aMsg.message = aMsg.message.replace(meRegExp, "$1");
       let actionMessageTemplate = "* %message% *";
       if (hasMetadataKey(aTheme, "ActionMessageTemplate"))
         actionMessageTemplate = getMetadata(aTheme, "ActionMessageTemplate");
       html = html.replace(/%message%/g, actionMessageTemplate);
     }
   }