Bug 1780549 - Disable Repair Folder for IMAP folders when in offline mode. r=benc
Differential Revision: https://phabricator.services.mozilla.com/D152960 --HG-- extra : rebase_source : 4608a2bb45f3b9a10fd37186527f9671c0ac191d extra : amend_source : 9a76a706869b14887bdb19325bcd97988f398b5d
This commit is contained in:
Родитель
6940818439
Коммит
77174e77a7
|
@ -3406,22 +3406,16 @@ var gFolderTreeController = {
|
|||
}
|
||||
}
|
||||
|
||||
// xxx useless param
|
||||
function rebuildSummary(aFolder) {
|
||||
// folder is already introduced in our containing function and is
|
||||
// lexically captured and available to us.
|
||||
async function rebuildSummary() {
|
||||
if (folder.locked) {
|
||||
folder.throwAlertMsg("operationFailedFolderBusy", msgWindow);
|
||||
return;
|
||||
}
|
||||
if (folder.supportsOffline) {
|
||||
// Remove the offline store, if any.
|
||||
let offlineStore = folder.filePath;
|
||||
// XXX todo: figure out how to delete a maildir directory async. This
|
||||
// delete causes main thread lockup for large maildir folders.
|
||||
if (offlineStore.exists()) {
|
||||
offlineStore.remove(true);
|
||||
}
|
||||
await IOUtils.remove(folder.filePath.path, { recursive: true }).catch(
|
||||
Cu.reportError
|
||||
);
|
||||
}
|
||||
|
||||
// We may be rebuilding a folder that is not the displayed one.
|
||||
|
|
|
@ -18,8 +18,12 @@ window.addEventListener("DOMContentLoaded", folderPropsOnLoad);
|
|||
document.addEventListener("dialogaccept", folderPropsOKButton);
|
||||
document.addEventListener("dialogcancel", folderCancelButton);
|
||||
|
||||
// The folderPropsSink is the class that gets notified of an imap folder's properties
|
||||
|
||||
/**
|
||||
* The folderPropsSink is the class that gets notified of an imap folder's
|
||||
* properties.
|
||||
*
|
||||
* @implements {nsIMsgImapFolderProps}
|
||||
*/
|
||||
var gFolderPropsSink = {
|
||||
setFolderType(folderTypeString) {
|
||||
var typeLabel = document.getElementById("folderType.text");
|
||||
|
@ -243,8 +247,6 @@ function folderPropsOnLoad() {
|
|||
gMsgFolder,
|
||||
"folderIconColor"
|
||||
);
|
||||
} else {
|
||||
dump("passed null for folder, do nothing\n");
|
||||
}
|
||||
|
||||
if (window.arguments[0].name) {
|
||||
|
@ -253,9 +255,6 @@ function folderPropsOnLoad() {
|
|||
// when the dialog is accepted.
|
||||
var nameTextbox = document.getElementById("name");
|
||||
nameTextbox.value = window.arguments[0].name;
|
||||
|
||||
// name.setSelectionRange(0,-1);
|
||||
// name.focusTextField();
|
||||
}
|
||||
|
||||
const serverType = window.arguments[0].serverType;
|
||||
|
@ -346,10 +345,8 @@ function folderPropsOnLoad() {
|
|||
}
|
||||
|
||||
if (serverType == "imap") {
|
||||
var imapFolder = gMsgFolder.QueryInterface(Ci.nsIMsgImapMailFolder);
|
||||
if (imapFolder) {
|
||||
imapFolder.fillInFolderProps(gFolderPropsSink);
|
||||
}
|
||||
let imapFolder = gMsgFolder.QueryInterface(Ci.nsIMsgImapMailFolder);
|
||||
imapFolder.fillInFolderProps(gFolderPropsSink);
|
||||
|
||||
let users = [...imapFolder.getOtherUsersWithAccess()];
|
||||
if (users.length) {
|
||||
|
@ -358,6 +355,11 @@ function folderPropsOnLoad() {
|
|||
", "
|
||||
);
|
||||
}
|
||||
|
||||
// Disable "Repair Folder" when offline as that would cause the offline store
|
||||
// to get deleted and redownloaded.
|
||||
document.getElementById("folderRebuildSummaryButton").disabled =
|
||||
gMsgFolder.supportsOffline && Services.io.offline;
|
||||
}
|
||||
|
||||
var retentionSettings = gMsgFolder.retentionSettings;
|
||||
|
@ -475,5 +477,5 @@ function onUseDefaultRetentionSettings() {
|
|||
}
|
||||
|
||||
function RebuildSummaryInformation() {
|
||||
window.arguments[0].rebuildSummaryCallback(gMsgFolder);
|
||||
window.arguments[0].rebuildSummaryCallback();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче