@bobfrankston/rmfmail 1.1.83 → 1.1.84

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.
package/.commitmsg CHANGED
@@ -1,5 +1,6 @@
1
- Viewer flag button: use a star glyph, matching the list star
1
+ Viewer Flag button reflects flagged state, like the list star
2
2
 
3
- The toolbar Flag button showed a while the message-list row uses
4
- ★/☆ for the same flag state. Changed the toolbar glyph to so the
5
- two are visibly the same action.
3
+ The toolbar Flag button is now in the default colour when the viewed
4
+ message is unflagged and a gold when flagged same glyph + colour
5
+ behaviour as the message-list row star. updateFlagButton() runs on
6
+ mailx-message-shown and after every toggle (including the error revert).
@@ -7447,17 +7447,28 @@ document.addEventListener("mailx-moved", (e) => {
7447
7447
  document.getElementById("btn-delete")?.addEventListener("click", deleteSelection);
7448
7448
  document.getElementById("btn-tb-delete")?.addEventListener("click", deleteSelection);
7449
7449
  document.getElementById("btn-tb-spam")?.addEventListener("click", spamSelectedMessages);
7450
+ function updateFlagButton() {
7451
+ const btn = document.getElementById("btn-flag");
7452
+ if (!btn) return;
7453
+ const sel = getCurrentFocused();
7454
+ const yes = !!sel && flaggedOf(sel);
7455
+ btn.classList.toggle("flagged", yes);
7456
+ btn.textContent = yes ? "\u2605" : "\u2606";
7457
+ }
7458
+ document.addEventListener("mailx-message-shown", updateFlagButton);
7450
7459
  document.getElementById("btn-flag")?.addEventListener("click", async () => {
7451
7460
  const sel = getCurrentFocused();
7452
7461
  if (!sel) return;
7453
7462
  const wasFlagged = flaggedOf(sel);
7454
7463
  setFlagged(sel, !wasFlagged);
7464
+ updateFlagButton();
7455
7465
  try {
7456
7466
  await updateFlags(sel.accountId, sel.uid, sel.flags);
7457
7467
  updateMessageFlags(sel.accountId, sel.uid, sel.flags);
7458
7468
  setRowFlagged(sel.accountId, sel.uid, !wasFlagged);
7459
7469
  } catch (e) {
7460
7470
  setFlagged(sel, wasFlagged);
7471
+ updateFlagButton();
7461
7472
  console.error(`Flag toggle failed: ${e.message}`);
7462
7473
  }
7463
7474
  });