Bug 1671748 - Check only STORAGE and MESSAGE for imap quota threshold met. r=mkmelin
authorGene Smith <gds@chartertn.net>
Sun, 18 Oct 2020 16:50:54 -0400
changeset 30863 bae6e0d9225a4944339f72570d4be50b37b4da3e
parent 30862 5ca66da6e4f9229a049de82499764d381b8226d8
child 30864 30e21fb59baa029452b05ff31fc3269ae5cdab0a
push id18086
push usergeoff@darktrojan.net
push dateMon, 19 Oct 2020 21:57:09 +0000
treeherdercomm-central@30e21fb59baa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1671748
Bug 1671748 - Check only STORAGE and MESSAGE for imap quota threshold met. r=mkmelin Don't check other like LEVEL and MAILBOX.
mail/base/content/commandglue.js
--- a/mail/base/content/commandglue.js
+++ b/mail/base/content/commandglue.js
@@ -139,17 +139,28 @@ function UpdateStatusQuota(folder) {
   if (!(folder && folder instanceof Ci.nsIMsgImapMailFolder)) {
     document.getElementById("quotaPanel").hidden = true;
     return;
   }
 
   let quotaUsagePercentage = q =>
     Number((100n * BigInt(q.usage)) / BigInt(q.limit));
 
-  let folderQuota = folder.getQuota();
+  // For display on main window panel only include quota names containing
+  // "STORAGE" or "MESSAGE". This will exclude unusual quota names containing
+  // items like "MAILBOX" and "LEVEL" from the panel bargraph. All quota names
+  // will still appear on the folder properties quota window.
+  // Note: Quota name is typically something like "User Quota / STORAGE".
+  let folderQuota = folder
+    .getQuota()
+    .filter(
+      quota =>
+        quota.name.toUpperCase().includes("STORAGE") ||
+        quota.name.toUpperCase().includes("MESSAGE")
+    );
   // If folderQuota not empty, find the index of the element with highest
   //  percent usage and determine if it is above the panel display threshold.
   if (folderQuota.length > 0) {
     let highest = folderQuota.reduce((acc, current) =>
       quotaUsagePercentage(acc) > quotaUsagePercentage(current) ? acc : current
     );
     let percent = quotaUsagePercentage(highest);
     if (