@bobfrankston/rmfmail 1.2.192 → 1.2.193

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/client/app.js CHANGED
@@ -1788,6 +1788,16 @@ async function performUndo() {
1788
1788
  statusSync.textContent = msgs.length === 1
1789
1789
  ? "Message restored"
1790
1790
  : `Restored ${msgs.length} messages`;
1791
+ // Position at what was just restored — an undo whose effect lands
1792
+ // off-screen (or in a folder you've since left) reads as a no-op.
1793
+ // Reveal the first of the batch; the rest are in the same view.
1794
+ // On a miss revealMessage restores the prior view itself.
1795
+ const first = msgs[0];
1796
+ if (first?.folderId) {
1797
+ await revealMessage(first.accountId, first.folderId, first.uid);
1798
+ syncChromeToListView();
1799
+ return;
1800
+ }
1791
1801
  }
1792
1802
  else if (op.kind === "move") {
1793
1803
  const { messages } = op.payload;
@@ -1807,6 +1817,14 @@ async function performUndo() {
1807
1817
  }
1808
1818
  if (statusSync)
1809
1819
  statusSync.textContent = `Undid move of ${messages.length} message${messages.length !== 1 ? "s" : ""}`;
1820
+ // Same positioning rule as undo-delete: show the message back in
1821
+ // its original folder.
1822
+ const firstMoved = messages[0];
1823
+ if (firstMoved?.sourceFolderId) {
1824
+ await revealMessage(firstMoved.accountId, firstMoved.sourceFolderId, firstMoved.uid);
1825
+ syncChromeToListView();
1826
+ return;
1827
+ }
1810
1828
  }
1811
1829
  else if (op.kind === "flag") {
1812
1830
  const { updateFlags } = await import("./lib/api-client.js");
@@ -2759,6 +2777,13 @@ async function closeSearchAndReveal() {
2759
2777
  // claimed search-on-All-Inboxes and the list looked broken (Bob
2760
2778
  // 2026-07-04 "cleared the search but it isn't restoring the list").
2761
2779
  // Sync tab, tree highlight and titles to what the list actually shows.
2780
+ syncChromeToListView();
2781
+ }
2782
+ /** Mirror tab, folder-tree highlight and titles to whatever view the message
2783
+ * list is actually showing. Needed after any list-driven navigation
2784
+ * (revealMessage from search-close or undo) — the list module can land on a
2785
+ * different folder than the surrounding chrome still claims. */
2786
+ function syncChromeToListView() {
2762
2787
  const vw = getCurrentView();
2763
2788
  if (vw.unified) {
2764
2789
  highlightFolder(null, -1);