Bug 1553478 - Fix OTR notification box shown for incorrect conversation. r=kaie
authorAlessandro Castellani <alessandro@thunderbird.net>
Tue, 28 May 2019 12:07:01 +0200
changeset 35699 588c1b465632525681d16fa331842ca610771504
parent 35698 34903ebb73e2e53f2eb5a84ce274f0ae5dc63d6e
child 35700 c999415db730294e7cc75c8e509ad1818695978c
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewerskaie
bugs1553478
Bug 1553478 - Fix OTR notification box shown for incorrect conversation. r=kaie
chat/modules/OTRUI.jsm
mail/components/im/content/chat-conversation-info.js
--- a/chat/modules/OTRUI.jsm
+++ b/chat/modules/OTRUI.jsm
@@ -316,16 +316,17 @@ var OTRUI = {
  *        disconnected?
  *          could the other side come back? should we keep the button?
  *        set the state based on the OTR library state
  */
 
   addButton(aObject) {
     this.globalDoc = aObject.ownerDocument;
     let _conv = aObject._conv;
+    OTRUI.visibleConv = _conv;
     OTRUI.setMsgState(_conv, null, this.globalDoc, true);
   },
 
   hideOTRButton() {
     if (!OTR.libLoaded)
       return;
     if (!this.globalDoc)
       return;
@@ -493,28 +494,32 @@ var OTRUI = {
       },
     }];
 
     let priority = this.globalBox.PRIORITY_WARNING_MEDIUM;
     this.globalBox.appendNotification(msg, context.username, null, priority, buttons, null);
 
     let verifyTitle = syncL10n.formatValue("verify-title");
     this.updateNotificationUI(context, verifyTitle, context.username, AuthVerify);
+
+    if (context.username !== this.visibleConv.normalizedName) {
+      this.hideUserNotifications(context);
+    }
   },
 
   updateNotificationUI(context, typeTitle, username, key) {
     let notification = this.globalBox.getNotificationWithValue(username);
     notification.setAttribute("user", context.username);
     notification.setAttribute("status", key);
     notification.setAttribute("orient", "vertical");
     notification.messageDetails.setAttribute("orient", "vertical");
     notification.messageDetails.removeAttribute("oncommand");
     notification.messageDetails.removeAttribute("align");
 
-    let title = this.globalDoc.createElement("title");
+    let title = this.globalDoc.createXULElement("title");
     title.setAttribute("flex", "1");
     title.setAttribute("crop", "end");
     title.textContent = typeTitle;
 
     let close = notification.querySelector("toolbarbutton");
     close.setAttribute("oncommand", "this.parentNode.parentNode.dismiss();");
 
     let top = this.globalDoc.createXULElement("hbox");
--- a/mail/components/im/content/chat-conversation-info.js
+++ b/mail/components/im/content/chat-conversation-info.js
@@ -62,17 +62,17 @@ class MozChatConversationInfo extends Mo
             <description class="displayName" flex="1" crop="end">
             </description>
             <image class="prplIcon"></image>
           </hbox>
           <description class="statusMessage" mousethrough="never" crop="end" flex="100000">
           </description>
         </stack>
       </hbox>
-      <hbox class="otr-container" align="left" valign="middle" flex="1" hidden="true">
+      <hbox class="otr-container" align="left" valign="middle" hidden="true">
         <label class="otr-label" crop="end" data-l10n-id="state-label" flex="1"/>
         <toolbarbutton id="otrButton"
                        mode="dialog"
                        class="otr-button toolbarbutton-1"
                        type="menu"
                        label="Insecure"
                        data-l10n-id="start-tooltip">
           <menupopup class="otr-menu-popup">