Bug 941914 - Properly store the value of "Messages more than x days old" box in Synchronization settings of News account. r=Neil
authoraceman <acelists@atlas.sk>
Mon, 02 Dec 2013 09:31:45 -0500
changeset 16946 91bfcd1f97cd3a952fea8120c56bb380ceafcd86
parent 16945 0fa8a688fa1ebf7d6e1077579de39a881a31442c
child 16947 27e9cb30c006738fc8a8070f30764a627ccd2f3c
push id1074
push userbugzilla@standard8.plus.com
push dateMon, 03 Feb 2014 22:47:23 +0000
treeherdercomm-beta@6b791b5369ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs941914
Bug 941914 - Properly store the value of "Messages more than x days old" box in Synchronization settings of News account. r=Neil
mailnews/base/content/retention.js
mailnews/base/prefs/content/am-offline.js
--- a/mailnews/base/content/retention.js
+++ b/mailnews/base/content/retention.js
@@ -4,18 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
 function initCommonRetentionSettings(retentionSettings)
 {
   document.getElementById("retention.keepUnread").checked =  retentionSettings.keepUnreadMessagesOnly;
   document.getElementById("retention.keepMsg").value = retentionSettings.retainByPreference;
-  if(retentionSettings.daysToKeepHdrs > 0)
-    document.getElementById("retention.keepOldMsgMin").value =
+  document.getElementById("retention.keepOldMsgMin").value =
     (retentionSettings.daysToKeepHdrs > 0) ? retentionSettings.daysToKeepHdrs : 30;
   document.getElementById("retention.keepNewMsgMin").value =
     (retentionSettings.numHeadersToKeep > 0) ? retentionSettings.numHeadersToKeep : 2000;
 
   document.getElementById("retention.applyToFlagged").checked =
     !retentionSettings.applyToFlaggedMessages;
 }
 
--- a/mailnews/base/prefs/content/am-offline.js
+++ b/mailnews/base/prefs/content/am-offline.js
@@ -42,40 +42,36 @@ function initServerSettings()
     else
         document.getElementById("offline.notDownloadMin").value = "50";
 
     if(gServerType == "imap") {
         gImapIncomingServer = gIncomingServer.QueryInterface(Components.interfaces.nsIImapIncomingServer);
         document.getElementById("offline.folders").checked =  gImapIncomingServer.offlineDownload;
     }
 }
-  
+
 function initRetentionSettings()
 {
-    var retentionSettings =  gIncomingServer.retentionSettings; 
-    initCommonRetentionSettings(retentionSettings);
+  let retentionSettings = gIncomingServer.retentionSettings;
+  initCommonRetentionSettings(retentionSettings);
 
-    document.getElementById("nntp.removeBody").checked =  retentionSettings.cleanupBodiesByDays;
-    if(retentionSettings.daysToKeepBodies > 0)
-        document.getElementById("nntp.removeBodyMin").setAttribute("value", retentionSettings.daysToKeepBodies);
-    else
-        document.getElementById("nntp.removeBodyMin").setAttribute("value", "30");
+  document.getElementById("nntp.removeBody").checked = retentionSettings.cleanupBodiesByDays;
+  document.getElementById("nntp.removeBodyMin").value =
+    (retentionSettings.daysToKeepBodies > 0) ? retentionSettings.daysToKeepBodies : 30;
 }
 
-
 function initDownloadSettings()
 {
-    var downloadSettings =  gIncomingServer.downloadSettings;
-    document.getElementById("nntp.downloadMsg").checked = downloadSettings.downloadByDate;
-    document.getElementById("nntp.notDownloadRead").checked = downloadSettings.downloadUnreadOnly;
-    if(downloadSettings.ageLimitOfMsgsToDownload > 0)
-        document.getElementById("nntp.downloadMsgMin").setAttribute("value", downloadSettings.ageLimitOfMsgsToDownload);
-    else
-        document.getElementById("nntp.downloadMsgMin").setAttribute("value", "30");
- 
+  let downloadSettings = gIncomingServer.downloadSettings;
+  document.getElementById("nntp.downloadMsg").checked = downloadSettings.downloadByDate;
+  document.getElementById("nntp.notDownloadRead").checked = downloadSettings.downloadUnreadOnly;
+  document.getElementById("nntp.downloadMsgMin").value =
+    (downloadSettings.ageLimitOfMsgsToDownload > 0) ?
+      downloadSettings.ageLimitOfMsgsToDownload : 30;
+
   // Figure out what the most natural division of the autosync pref into
   // a value and an interval is.
   let autosyncSelect = document.getElementById("autosyncSelect");
   let autosyncInterval = document.getElementById("autosyncInterval");
   let autosyncValue = document.getElementById("autosyncValue");
   let autosyncPref = document.getElementById("imap.autoSyncMaxAgeDays");
   let autosyncPrefValue = (autosyncPref.value == "") ? -1 :
                                                parseInt(autosyncPref.value, 10);