Bug 1563789 - Hide the appmenu's "View > Messages" item sometimes. r=darktrojan a=jorgk BETA_68_CONTINUATION
authorPaul Morris <paul@paulwmorris.com>
Fri, 05 Jul 2019 14:14:07 -0400
branchBETA_68_CONTINUATION
changeset 36063 883281c5e30fc82ae8b787187f0c220ac7e66cf0
parent 36062 f53a5e4487e6a27251cd7d45937edef39d05129e
child 36064 db02405147d0bf65623884eb4f9add11468b6d23
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersdarktrojan, jorgk
bugs1563789
Bug 1563789 - Hide the appmenu's "View > Messages" item sometimes. r=darktrojan a=jorgk Hide it if the "Views" toolbar widget is not in the toolbar.
mail/base/content/mailWindowOverlay.js
mail/components/customizableui/content/panelUI.inc.xul
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -179,18 +179,19 @@ function InitAppFolderViewsMenu() {
   }
 }
 
 function InitGoMessagesMenu() {
   document.commandDispatcher.updateCommands("create-menu-go");
 }
 
 /**
- * This is called every time the view menu popup is displayed.  It is
- *  responsible for updating the menu items' state to reflect reality.
+ * This is called every time the view menu popup is displayed (in the main menu
+ * bar or in the appmenu).  It is responsible for updating the menu items'
+ * state to reflect reality.
  */
 function view_init() {
   let isFeed = gFolderDisplay &&
                (FeedMessageHandler.isFeedFolder(gFolderDisplay.displayedFolder) ||
                 gFolderDisplay.selectedMessageIsFeed);
 
   let accountCentralDisplayed = gFolderDisplay.isAccountCentralDisplayed;
   let messagePaneMenuItem = document.getElementById("menu_showMessage");
@@ -242,20 +243,23 @@ function view_init() {
     appmenuViewMessageView.disabled = accountCentralDisplayed;
 
   document.getElementById("viewMessagesMenu").disabled = accountCentralDisplayed;
 
   let appmenuViewMessagesMenu = document.getElementById("appmenu_viewMessagesMenu");
   if (appmenuViewMessagesMenu)
     appmenuViewMessagesMenu.disabled = accountCentralDisplayed;
 
-  // Hide the views menu item if the user doesn't have the views toolbar button
-  // visible.
+  // Hide the "View > Messages" menu item if the user doesn't have the "Views"
+  // (aka "Mail Views") toolbar button in the main toolbar. (See bug 1563789.)
   var viewsToolbarButton = document.getElementById("mailviews-container");
   document.getElementById("viewMessageViewMenu").hidden = !viewsToolbarButton;
+  if (appmenuViewMessageView) {
+    appmenuViewMessageView.hidden = !viewsToolbarButton;
+  }
 
   // Initialize the Message Body menuitem
   document.getElementById("viewBodyMenu").hidden = isFeed;
 
   let appmenuViewBodyMenu = document.getElementById("appmenu_viewBodyMenu");
   if (appmenuViewBodyMenu)
     appmenuViewBodyMenu.hidden = isFeed;
 
--- a/mail/components/customizableui/content/panelUI.inc.xul
+++ b/mail/components/customizableui/content/panelUI.inc.xul
@@ -1027,17 +1027,16 @@
                        closemenu="none"
                        oncommand="PanelUI.showSubView('appMenu-viewMessagesTagsView', this)"/>
         <toolbarbutton id="appmenu_viewMessageCustomViews"
                        class="subviewbutton subviewbutton-nav"
                        label="&viewCustomViews.label;"
                        closemenu="none"
                        oncommand="PanelUI.showSubView('appMenu-viewMessagesCustomViewsView', this)"/>
         <toolbarseparator id="appmenu_messageViewAfterCustomSeparator"/>
-        <!-- TODO appmenu - broken? broken already? -->
         <toolbarbutton id="appmenu_viewMessageVirtualFolder"
                        class="subviewbutton subviewbutton-iconic"
                        value="7"
                        label="&viewVirtualFolder.label;"
                        oncommand="ViewChangeByMenuitem(event.target);"/>
         <toolbarbutton id="appmenu_viewMessageCustomize"
                        class="subviewbutton subviewbutton-iconic"
                        value="8"