From f1f448d090c2d45c3a80a640eb7b1ed9bf5b1b7f Mon Sep 17 00:00:00 2001 From: Magnus Melin Date: Tue, 5 Dec 2023 11:26:59 +0200 Subject: [PATCH] Bug 1868214 - remove mail.openpgp.key_assistant.enable. r=kaie Differential Revision: https://phabricator.services.mozilla.com/D195478 --HG-- extra : rebase_source : e322fa4cfbb9c7ad0c7e54f7ec1cf4e787290de2 extra : amend_source : 7e5069b4c4adac1ee8dc28eda2a140fb0f2b0a73 --- .../compose/content/MsgComposeCommands.js | 18 +- mail/extensions/am-e2e/prefs/e2e-prefs.js | 2 - .../openpgp/content/ui/composeKeyStatus.js | 222 ------------------ .../openpgp/content/ui/composeKeyStatus.xhtml | 103 -------- .../openpgp/content/ui/oneRecipientStatus.js | 177 -------------- .../content/ui/oneRecipientStatus.xhtml | 89 ------- mail/extensions/openpgp/jar.mn | 4 - .../messenger/openpgp/composeKeyStatus.ftl | 14 -- mail/themes/shared/jar.inc.mn | 1 - .../shared/openpgp/openPgpComposeStatus.css | 25 -- 10 files changed, 1 insertion(+), 654 deletions(-) delete mode 100644 mail/extensions/openpgp/content/ui/composeKeyStatus.js delete mode 100644 mail/extensions/openpgp/content/ui/composeKeyStatus.xhtml delete mode 100644 mail/extensions/openpgp/content/ui/oneRecipientStatus.js delete mode 100644 mail/extensions/openpgp/content/ui/oneRecipientStatus.xhtml delete mode 100644 mail/themes/shared/openpgp/openPgpComposeStatus.css diff --git a/mail/components/compose/content/MsgComposeCommands.js b/mail/components/compose/content/MsgComposeCommands.js index f3f112ba11..6fe688155a 100644 --- a/mail/components/compose/content/MsgComposeCommands.js +++ b/mail/components/compose/content/MsgComposeCommands.js @@ -1845,23 +1845,7 @@ function setSecuritySettings(menu_id) { */ function showMessageComposeSecurityStatus(isSending = false) { if (gSelectedTechnologyIsPGP) { - if ( - Services.prefs.getBoolPref("mail.openpgp.key_assistant.enable", false) - ) { - gKeyAssistant.show(getEncryptionCompatibleRecipients(), isSending); - } else { - Recipients2CompFields(gMsgCompose.compFields); - window.openDialog( - "chrome://openpgp/content/ui/composeKeyStatus.xhtml", - "", - "chrome,modal,resizable,centerscreen", - { - compFields: gMsgCompose.compFields, - currentIdentity: gCurrentIdentity, - } - ); - checkEncryptionState(); - } + gKeyAssistant.show(getEncryptionCompatibleRecipients(), isSending); } else { Recipients2CompFields(gMsgCompose.compFields); // Copy current flags to S/MIME composeSecure object. diff --git a/mail/extensions/am-e2e/prefs/e2e-prefs.js b/mail/extensions/am-e2e/prefs/e2e-prefs.js index 1a88003a75..9528712221 100644 --- a/mail/extensions/am-e2e/prefs/e2e-prefs.js +++ b/mail/extensions/am-e2e/prefs/e2e-prefs.js @@ -47,8 +47,6 @@ pref("mail.openpgp.separate_mime_layers", false); // If you need to specify a path, use a file:// URL pref("mail.openpgp.alias_rules_file", ""); -pref("mail.openpgp.key_assistant.enable", true); - // If set to true, enable user interface that allows the user to optionally set // and manage individual, user-defined passphrases for OpenPGP secret keys. // If set to false, the respective user interface will be hidden. diff --git a/mail/extensions/openpgp/content/ui/composeKeyStatus.js b/mail/extensions/openpgp/content/ui/composeKeyStatus.js deleted file mode 100644 index 0e5bfad400..0000000000 --- a/mail/extensions/openpgp/content/ui/composeKeyStatus.js +++ /dev/null @@ -1,222 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -var { EnigmailFuncs } = ChromeUtils.import( - "chrome://openpgp/content/modules/funcs.jsm" -); -var EnigmailKeyRing = ChromeUtils.import( - "chrome://openpgp/content/modules/keyRing.jsm" -).EnigmailKeyRing; -var { EnigmailWindows } = ChromeUtils.import( - "chrome://openpgp/content/modules/windows.jsm" -); -var { EnigmailKey } = ChromeUtils.import( - "chrome://openpgp/content/modules/key.jsm" -); -const { OpenPGPAlias } = ChromeUtils.import( - "chrome://openpgp/content/modules/OpenPGPAlias.jsm" -); -const { PgpSqliteDb2 } = ChromeUtils.import( - "chrome://openpgp/content/modules/sqliteDb.jsm" -); - -var gListBox; -var gViewButton; - -var gEmailAddresses = []; -var gRowToEmail = []; - -// One boolean entry per row. True means it is an alias row. -// This allows us to use different dialog behavior for alias entries. -var gAliasRows = []; - -var gMapAddressToKeyObjs = null; - -function addRecipients(toAddrList, recList) { - for (var i = 0; i < recList.length; i++) { - try { - const entry = EnigmailFuncs.stripEmail(recList[i].replace(/[",]/g, "")); - toAddrList.push(entry); - } catch (ex) { - console.debug(ex); - } - } -} - -async function setListEntries() { - gMapAddressToKeyObjs = new Map(); - - for (let addr of gEmailAddresses) { - addr = addr.toLowerCase(); - - let statusStringID = null; - let statusStringDirect = ""; - - const aliasKeyList = EnigmailKeyRing.getAliasKeyList(addr); - const isAlias = !!aliasKeyList; - - if (isAlias) { - const aliasKeys = EnigmailKeyRing.getAliasKeys(aliasKeyList); - if (!aliasKeys.length) { - // failure, at least one alias key is unusable/unavailable - statusStringDirect = await document.l10n.formatValue( - "openpgp-compose-alias-status-error" - ); - } else { - statusStringDirect = await document.l10n.formatValue( - "openpgp-compose-alias-status-direct", - { - count: aliasKeys.length, - } - ); - } - } else { - // We ask to include keys which are expired, because that's what - // our sub dialog oneRecipientStatus needs. This is for - // efficiency - because otherwise the sub dialog would have to - // query all keys again. - // The consequence is, we need to later call isValidForEncryption - // for the keys we have obtained, to confirm they are really valid. - const foundKeys = await EnigmailKeyRing.getMultValidKeysForOneRecipient( - addr, - true - ); - if (!foundKeys || !foundKeys.length) { - statusStringID = "openpgp-recip-missing"; - } else { - gMapAddressToKeyObjs.set(addr, foundKeys); - for (const keyObj of foundKeys) { - let goodPersonal = false; - if (keyObj.secretAvailable) { - goodPersonal = await PgpSqliteDb2.isAcceptedAsPersonalKey( - keyObj.fpr - ); - } - if ( - goodPersonal || - (EnigmailKeyRing.isValidForEncryption(keyObj) && - (keyObj.acceptance == "verified" || - keyObj.acceptance == "unverified")) - ) { - statusStringID = "openpgp-recip-good"; - break; - } - } - if (!statusStringID) { - statusStringID = "openpgp-recip-none-accepted"; - } - } - } - - const listitem = document.createXULElement("richlistitem"); - - const emailItem = document.createXULElement("label"); - emailItem.setAttribute("value", addr); - emailItem.setAttribute("crop", "end"); - emailItem.setAttribute("style", "width: var(--recipientWidth)"); - listitem.appendChild(emailItem); - - const status = document.createXULElement("label"); - - if (statusStringID) { - document.l10n.setAttributes(status, statusStringID); - } else { - status.setAttribute("value", statusStringDirect); - } - - status.setAttribute("crop", "end"); - status.setAttribute("style", "width: var(--statusWidth)"); - listitem.appendChild(status); - - gListBox.appendChild(listitem); - - gRowToEmail.push(addr); - gAliasRows.push(isAlias); - } -} - -async function onLoad() { - const params = window.arguments[0]; - if (!params) { - return; - } - - try { - await OpenPGPAlias.load(); - } catch (ex) { - console.log("failed to load OpenPGP alias file: " + ex); - } - - gListBox = document.getElementById("infolist"); - gViewButton = document.getElementById("detailsButton"); - - var arrLen = {}; - var recList; - - if (params.compFields.to) { - recList = params.compFields.splitRecipients( - params.compFields.to, - true, - arrLen - ); - addRecipients(gEmailAddresses, recList); - } - if (params.compFields.cc) { - recList = params.compFields.splitRecipients( - params.compFields.cc, - true, - arrLen - ); - addRecipients(gEmailAddresses, recList); - } - if (params.compFields.bcc) { - recList = params.compFields.splitRecipients( - params.compFields.bcc, - true, - arrLen - ); - addRecipients(gEmailAddresses, recList); - } - - await setListEntries(); -} - -async function reloadAndReselect(selIndex = -1) { - while (true) { - const child = gListBox.lastChild; - // keep first child, which is the header - if (child == gListBox.firstChild) { - break; - } - gListBox.removeChild(child); - } - gRowToEmail = []; - await setListEntries(); - gListBox.selectedIndex = selIndex; -} - -function onSelectionChange(event) { - // We don't offer detail management/discovery for email addresses - // that match an alias rule. - gViewButton.disabled = - !gListBox.selectedItems.length || gAliasRows[gListBox.selectedIndex]; -} - -function viewSelectedEmail() { - const selIndex = gListBox.selectedIndex; - if (gViewButton.disabled || selIndex == -1) { - return; - } - const email = gRowToEmail[selIndex]; - window.openDialog( - "chrome://openpgp/content/ui/oneRecipientStatus.xhtml", - "", - "chrome,modal,resizable,centerscreen", - { - email, - keys: gMapAddressToKeyObjs.get(email), - } - ); - reloadAndReselect(selIndex); -} diff --git a/mail/extensions/openpgp/content/ui/composeKeyStatus.xhtml b/mail/extensions/openpgp/content/ui/composeKeyStatus.xhtml deleted file mode 100644 index 32b5d9ce39..0000000000 --- a/mail/extensions/openpgp/content/ui/composeKeyStatus.xhtml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - diff --git a/mail/extensions/openpgp/jar.mn b/mail/extensions/openpgp/jar.mn index b61ea162c3..317c017854 100644 --- a/mail/extensions/openpgp/jar.mn +++ b/mail/extensions/openpgp/jar.mn @@ -54,7 +54,6 @@ openpgp.jar: content/openpgp/ui/backupKeyPassword.js (content/ui/backupKeyPassword.js) content/openpgp/ui/changeExpiryDlg.js (content/ui/changeExpiryDlg.js) content/openpgp/ui/commonWorkflows.js (content/ui/commonWorkflows.js) - content/openpgp/ui/composeKeyStatus.js (content/ui/composeKeyStatus.js) content/openpgp/ui/confirmPubkeyImport.js (content/ui/confirmPubkeyImport.js) content/openpgp/ui/enigmailCommon.js (content/ui/enigmailCommon.js) content/openpgp/ui/enigmailKeyImportInfo.js (content/ui/enigmailKeyImportInfo.js) @@ -66,11 +65,9 @@ openpgp.jar: content/openpgp/ui/keyAssistant.js (content/ui/keyAssistant.js) content/openpgp/ui/keyDetailsDlg.js (content/ui/keyDetailsDlg.js) content/openpgp/ui/keyWizard.js (content/ui/keyWizard.js) - content/openpgp/ui/oneRecipientStatus.js (content/ui/oneRecipientStatus.js) content/openpgp/ui/attachmentItemContext.inc.xhtml (content/ui/attachmentItemContext.inc.xhtml) content/openpgp/ui/backupKeyPassword.xhtml (content/ui/backupKeyPassword.xhtml) content/openpgp/ui/changeExpiryDlg.xhtml (content/ui/changeExpiryDlg.xhtml) - content/openpgp/ui/composeKeyStatus.xhtml (content/ui/composeKeyStatus.xhtml) content/openpgp/ui/confirmPubkeyImport.xhtml (content/ui/confirmPubkeyImport.xhtml) content/openpgp/ui/enigmailKeyImportInfo.xhtml (content/ui/enigmailKeyImportInfo.xhtml) content/openpgp/ui/enigmailKeyManager.xhtml (content/ui/enigmailKeyManager.xhtml) @@ -78,4 +75,3 @@ openpgp.jar: content/openpgp/ui/keyAssistant.inc.xhtml (content/ui/keyAssistant.inc.xhtml) content/openpgp/ui/keyDetailsDlg.xhtml (content/ui/keyDetailsDlg.xhtml) content/openpgp/ui/keyWizard.xhtml (content/ui/keyWizard.xhtml) - content/openpgp/ui/oneRecipientStatus.xhtml (content/ui/oneRecipientStatus.xhtml) diff --git a/mail/locales/en-US/messenger/openpgp/composeKeyStatus.ftl b/mail/locales/en-US/messenger/openpgp/composeKeyStatus.ftl index cd3abc5f86..f99416482f 100644 --- a/mail/locales/en-US/messenger/openpgp/composeKeyStatus.ftl +++ b/mail/locales/en-US/messenger/openpgp/composeKeyStatus.ftl @@ -2,20 +2,6 @@ # 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/. -openpgp-compose-key-status-intro-need-keys = To send an end-to-end encrypted message, you must obtain and accept a public key for each recipient. -openpgp-compose-key-status-keys-heading = Availability of OpenPGP keys: -openpgp-compose-key-status-title = - .title = OpenPGP Message Security -openpgp-compose-key-status-recipient = - .label = Recipient -openpgp-compose-key-status-status = - .label = Status -openpgp-compose-key-status-open-details = Manage keys for selected recipient… -openpgp-recip-good = ok -openpgp-recip-missing = no key available -openpgp-recip-none-accepted = no accepted key -openpgp-compose-general-info-alias = { -brand-short-name} normally requires that the recipient’s public key contains a user ID with a matching email address. This can be overridden by using OpenPGP recipient alias rules. -openpgp-compose-general-info-alias-learn-more = Learn more # Variables: # $count (Number) - Number of alias keys for a recipient. openpgp-compose-alias-status-direct = { $count -> diff --git a/mail/themes/shared/jar.inc.mn b/mail/themes/shared/jar.inc.mn index 6a9b6c9d1d..00dc7f98f1 100644 --- a/mail/themes/shared/jar.inc.mn +++ b/mail/themes/shared/jar.inc.mn @@ -453,7 +453,6 @@ skin/classic/messenger/openpgp/keyWizard.css (../shared/openpgp/keyWizard.css) skin/classic/messenger/openpgp/inlineNotification.css (../shared/openpgp/inlineNotification.css) - skin/classic/messenger/openpgp/openPgpComposeStatus.css (../shared/openpgp/openPgpComposeStatus.css) skin/classic/messenger/smime/msgCompSecurityInfo.css (../shared/smime/msgCompSecurityInfo.css) # Illustrations diff --git a/mail/themes/shared/openpgp/openPgpComposeStatus.css b/mail/themes/shared/openpgp/openPgpComposeStatus.css deleted file mode 100644 index 3acb9c1b02..0000000000 --- a/mail/themes/shared/openpgp/openPgpComposeStatus.css +++ /dev/null @@ -1,25 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -@import url("chrome://messenger/skin/messenger.css"); - -treecolpicker { - display: none; -} - -#recipientKeyIdCol { - flex: 3; -} - -#recipientStatusCol { - flex: 4; -} - -#recipientComposeKeyCol { - flex: 3; -} - -#statusComposeKeyCol { - flex: 2; -}