@bobfrankston/rmfmail 1.2.312 → 1.2.314

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2931,21 +2931,25 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
2931
2931
  }, separator: true });
2932
2932
  }
2933
2933
  const listSpam = msg.spamScore;
2934
- if (listSpam?.listProved && listSpam.listId && !listSpam.listTrusted) {
2934
+ if (listSpam?.listProved && listSpam.listId) {
2935
2935
  const listId = listSpam.listId;
2936
+ const untrust = !!listSpam.listTrusted;
2936
2937
  items.push({
2937
- label: `\u2713 Trust the ${listId} mailing list`,
2938
+ label: untrust ? `\u2717 Stop trusting the ${listId} mailing list` : `\u2713 Trust the ${listId} mailing list`,
2938
2939
  action: async () => {
2939
2940
  const st = document.getElementById("status-sync");
2940
2941
  try {
2941
2942
  const res = await trustSenderOrDomain("list", listId);
2942
- if (!res?.trusted)
2943
+ if (!res || !!res.trusted === untrust)
2943
2944
  throw new Error("the list did not save");
2944
- listSpam.listTrusted = true;
2945
- document.querySelector(".mv-spamscore")?.remove();
2946
- document.querySelector(".mv-trust")?.remove();
2945
+ listSpam.listTrusted = res.trusted;
2946
+ if (res.trusted) {
2947
+ document.querySelector(".mv-spamscore")?.remove();
2948
+ document.querySelector(".mv-spamscore-action")?.remove();
2949
+ document.querySelector(".mv-trust")?.remove();
2950
+ }
2947
2951
  if (st)
2948
- st.textContent = `Trusting the ${listId} mailing list`;
2952
+ st.textContent = res.trusted ? `Trusting the ${listId} mailing list` : `No longer trusting the ${listId} mailing list \u2014 reopen the message to see its score again`;
2949
2953
  } catch (e2) {
2950
2954
  if (st) {
2951
2955
  st.textContent = `Couldn't trust the ${listId} list \u2014 ${e2?.message || e2}`;
@@ -3192,6 +3196,29 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
3192
3196
  Delivered by the ${spam.listId} mailing list, which your server proved sent it. Right-click the From address to trust the list.` : "");
3193
3197
  chip.textContent = `spam score ${spam.score} of ${spam.threshold}`;
3194
3198
  bodyEl.appendChild(chip);
3199
+ if (spam.listProved && spam.listId && !spam.listTrusted) {
3200
+ const listId = spam.listId;
3201
+ const b = document.createElement("button");
3202
+ b.className = "mv-trust-action mv-spamscore-action";
3203
+ b.textContent = `Trust the ${listId} list`;
3204
+ b.title = `Delivered by the ${listId} mailing list, which your server proved sent it. Trusting the list hides this score on every post the list delivers.`;
3205
+ b.addEventListener("click", async () => {
3206
+ b.disabled = true;
3207
+ try {
3208
+ const res = await trustSenderOrDomain("list", listId);
3209
+ if (!res?.trusted)
3210
+ throw new Error("the list did not save");
3211
+ spam.listTrusted = true;
3212
+ chip.remove();
3213
+ b.remove();
3214
+ document.querySelector(".mv-trust")?.remove();
3215
+ } catch (e) {
3216
+ b.disabled = false;
3217
+ b.textContent = `Could not save: ${e?.message || e}`;
3218
+ }
3219
+ });
3220
+ bodyEl.appendChild(b);
3221
+ }
3195
3222
  }
3196
3223
  const trust = msg.trust || [];
3197
3224
  if (trust.length) {
@@ -3233,6 +3260,13 @@ Delivered by the ${spam.listId} mailing list, which your server proved sent it.
3233
3260
  warn.appendChild(actions);
3234
3261
  }
3235
3262
  const lists = worst === "danger" ? [] : Array.from(new Set(trust.map((f) => f.list).filter(Boolean)));
3263
+ const listSpam = msg.spamScore;
3264
+ if (worst === "danger" && listSpam?.listProved && listSpam.listId) {
3265
+ const note = document.createElement("div");
3266
+ note.className = "mv-trust-foot";
3267
+ note.textContent = listSpam.listTrusted ? `Delivered by the ${listSpam.listId} mailing list, which you trust \u2014 that does not clear this finding.` : `Delivered by the ${listSpam.listId} mailing list. Trusting the list (right-click the From address) would not clear this finding.`;
3268
+ warn.appendChild(note);
3269
+ }
3236
3270
  if (lists.length) {
3237
3271
  const actions = document.createElement("div");
3238
3272
  actions.className = "mv-trust-actions";