Browse Source

Improve logging related to privacy display (rating, keylist).

1.1.101
Jorg Knobloch 2 years ago
parent
commit
5950463194
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      addon/content/pepmsghdrview.js

+ 7
- 6
addon/content/pepmsghdrview.js View File

@ -297,7 +297,7 @@ var pEpHdrView = {
// Load stored privacy label.
let rating = msgHdr.getStringProperty("pEpPrivacyRating");
if (rating) rating = parseInt(rating, 10);
this.updatePrivacy(this.win, msgHdr, rating);
this.updatePrivacy(this.win, msgHdr, rating, msgHdr.getStringProperty("pEpKeyList"));
const messagePanelFrame = this.win.document.getElementById("messagepane").contentWindow;
pEpController.log.debug("pepmsghdrview.js: onStartHeaders(), frame: ", messagePanelFrame);
@ -424,17 +424,15 @@ var pEpHdrView = {
}
let ratingPromise;
let isDraftorTemplate; // For debug only.
if (message.enc_format == ENC_FORMAT_DECRYPTED &&
message.opt_fields && message.opt_fields.find((e) => e.key == "X-Mozilla-Draft-Info") &&
message.from && message.from.address && TbHelper.isOwnIdentity(message.from.address)) {
// This is a draft/template we can decrypt. For now, use an outgoing rating,
// see https://pep.foundation/jira/browse/ENGINE-806.
ratingPromise = pEpController.getOutgoingRating(message.from, message.to || [], message.cc, message.bcc);
isDraftorTemplate = true;
pEpController.log.debug("Getting outgoing rating for draft/template");
} else {
ratingPromise = Promise.resolve(message.rating);
isDraftorTemplate = false;
}
// We need to wait here in case the message is copied later.
@ -444,7 +442,6 @@ var pEpHdrView = {
if (keyList) msgHdr.setStringProperty("pEpKeyList", keyList.value);
msgHdr.setStringProperty("pEpPrivacyRating", rating.toString(10));
this.updatePrivacy(this.win, msgHdr, rating, keyList.value);
pEpController.log.debug("updatePrivacyFromMessage: set rating to ", rating, keyList, isDraftorTemplate);
},
updatePrivacy(win, msgHdr, rating, keyList = null) {
@ -454,6 +451,10 @@ var pEpHdrView = {
oldNode.parentNode.removeChild(oldNode);
}
pEpController.log.debug(
`updatePrivacy: folder="${msgHdr.folder.name}", key=${msgHdr.messageKey}, rating=${rating}, keylist=${keyList}`,
);
if (!rating || rating == 3) {
// Return if there's no status to show
return;
@ -468,7 +469,7 @@ var pEpHdrView = {
let privacyLabel = this.getLocaleMessage(pEpController.textFromRating(rating));
if (keyList && Services.prefs.getBoolPref("extensions.pEp.showFPR", false)) {
// eslint-disable-next-line prefer-template
privacyLabel += " - FPR: " + keyList;
privacyLabel += " (" + keyList + ")";
}
const privacyTextNode = win.document.createTextNode(privacyLabel);
newNode.appendChild(privacyTextNode);


Loading…
Cancel
Save