Browse Source

Adjust comments due to new behaviour of onRecipientsChanged() in TB 78.6.1.

1.1.101
Jorg Knobloch 1 year ago
parent
commit
2cfa1dc2a0
1 changed files with 19 additions and 4 deletions
  1. +19
    -4
      addon/content/pepmessengercompose.js

+ 19
- 4
addon/content/pepmessengercompose.js View File

@ -241,6 +241,7 @@ var pEpComposer = {
// Turns out that in TB 68 onRecipientsChanged() is called for every recipient.
// So in order to cater for that, we don't use preview during the first second.
// What a hack :-(
// TODO: Remove the hack once TB 68 is no longer supported.
if (Date.now() - this.firstUpdateAt < 1000) preview = false;
if (this.shouldEncrypt) {
@ -258,10 +259,8 @@ var pEpComposer = {
this.updateUI(this.rating);
return;
}
// Let's get a "preview" rating here so that incomplete addresses don't end up
// in the database (last `true` parameter).
// TODO: From TB 74 onwards we can drop the "preview" altogether since we will only
// be called when a recipient "pill" is complete, not for every keystroke.
// Since on versions before TB 74 we used a preview rating, we need to trigger
// a "full" rating once the address entry is finished, that is on blur.
if (this.preTB74) {
let focusedElement = this.win.document.activeElement;
if (focusedElement && focusedElement.classList.contains("textbox-input") &&
@ -270,6 +269,16 @@ var pEpComposer = {
focusedElement.addEventListener("blur", () => this.updateRating(), false);
}
}
// If appropriate, let's get a "preview" rating here so that incomplete addresses
// don't end up in the database (`preview` parameter).
// TODO: Remove "preview" processing once TB 68 is no longer supported.
// Update January 2021: Since https://bugzilla.mozilla.org/show_bug.cgi?id=1679848
// published in TB 78.6.1, this again runs on every keystroke, not only
// when the recipient pill entry is complete, like from TB 74 to TB 78.6.0.
// However, in TB 78 `Recipients2CompFields()` only returns addresses from
// completed recipient pills, so despite calling this on every keystroke,
// incomplete addresses do not end up in the database.
pEpController.getOutgoingRating(from, to, cc, bcc, preview).then((rating) => {
// In TB 74 and onwards, it can happen that this promise comes back after
// we switched to a From: which doesn't want encryption. So check again.
@ -365,6 +374,12 @@ var pEpComposer = {
this.win.onRecipientsChanged = (aAutomatic) => {
this.tb_onRecipientsChanged(aAutomatic);
// Before TB 74 this runs on every keystroke, so let's get a preview here.
// Update January 2021: Since https://bugzilla.mozilla.org/show_bug.cgi?id=1679848
// published in TB 78.6.1, this again runs on every keystroke.
// However, in TB 78 `Recipients2CompFields()` only returns addresses from
// completed recipient pills, so despite calling this on every keystroke,
// incomplete addresses do not end up in the database.
this.updateRating(this.preTB74);
};


Loading…
Cancel
Save