Bug 1280058 - Warning for destructive retention settings for POP and IMAP accounts shouldn't be shown for Local Folders. ui-r=Paenglab r=Ratty,aceman a=jorgk
authorrsx11m <rsx11m.pub@gmail.com>
Tue, 14 Jun 2016 10:21:50 -0500
changeset 27288 12e810cf04e34ec88df8b8f3be3c61a7a762c923
parent 27287 dedc7000c465fe0aa911c5f3592d305eceb466f1
child 27289 fb9039ca8a54ebb4cf622b681b643248ad195fea
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersPaenglab, Ratty, aceman, jorgk
bugs1280058
Bug 1280058 - Warning for destructive retention settings for POP and IMAP accounts shouldn't be shown for Local Folders. ui-r=Paenglab r=Ratty,aceman a=jorgk
mailnews/base/prefs/content/am-offline.js
mailnews/base/prefs/content/am-offline.xul
--- a/mailnews/base/prefs/content/am-offline.js
+++ b/mailnews/base/prefs/content/am-offline.js
@@ -324,24 +324,26 @@ function restoreOfflineFolders(offlineFo
       if (offlineFolderMap[folder.folderURL])
         folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
       else
         folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
     }
 }
 
 /**
- * Checks if the user selected a permanent removal of messages from server and
- * warns about it.
+ * Checks if the user selected a permanent removal of messages from a server
+ * listed in the confirmfor attribute and warns about it.
  *
  * @param aRadio  The radiogroup element containing the retention options.
  */
 function warnServerRemove(aRadio)
 {
-  if (aRadio.value != 1) {
+  let confirmFor = aRadio.getAttribute("confirmfor");
+
+  if (confirmFor && confirmFor.split(',').includes(gServerType) && aRadio.value != 1) {
     let prefBundle = document.getElementById("bundle_prefs");
     let title = prefBundle.getString("removeFromServerTitle");
     let question = prefBundle.getString("removeFromServer");
     if (!Services.prompt.confirm(window, title, question)) {
       // If the user doesn't agree, fall back to not deleting anything.
       aRadio.value = 1;
       onCheckKeepMsg();
     }
--- a/mailnews/base/prefs/content/am-offline.xul
+++ b/mailnews/base/prefs/content/am-offline.xul
@@ -114,17 +114,17 @@
     </hbox>
 
     <vbox align="start">
     <separator hidefor="none,rss"/>
     <label id="retentionDescription" hidefor="imap,pop3" class="desc" control="retention.keepMsg">&retentionCleanup.label;</label>
     <label id="retentionDescriptionImap" hidefor="movemail,pop3,nntp,none,rss" class="desc" control="retention.keepMsg">&retentionCleanupImap.label;</label>
     <label id="retentionDescriptionPop" hidefor="movemail,imap,nntp,none,rss" class="desc" control="retention.keepMsg">&retentionCleanupPop.label;</label>
 
-    <radiogroup wsm_persist="true" hidefor="" id="retention.keepMsg" class="indent"
+    <radiogroup wsm_persist="true" hidefor="" confirmfor="imap,pop3" id="retention.keepMsg" class="indent"
                 oncommand="warnServerRemove(this);">
         <radio wsm_persist="true" id="retention.keepAllMsg" value="1" accesskey="&retentionKeepAll.accesskey;"
             label="&retentionKeepAll.label;" oncommand="onCheckKeepMsg();"/>
         <hbox flex="1" align="center">
             <radio wsm_persist="true" id="retention.keepNewMsg" accesskey="&retentionKeepRecent.accesskey;" 
                 value="3" label="&retentionKeepRecent.label;" oncommand="onCheckKeepMsg();"/>
             <textbox wsm_persist="true" id="retention.keepNewMsgMin"
                      type="number" min="1" increment="10" size="4" value="2000"