@bobfrankston/rmfmail 1.1.249 → 1.1.251

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.
@@ -1,7 +1,12 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __esm = (fn, res) => function __init() {
4
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
3
+ var __esm = (fn, res, err) => function __init() {
4
+ if (err) throw err[0];
5
+ try {
6
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
7
+ } catch (e) {
8
+ throw err = [e], e;
9
+ }
5
10
  };
6
11
  var __export = (target, all) => {
7
12
  for (var name in all)
@@ -746,25 +751,32 @@ function getMessages2() {
746
751
  return messages;
747
752
  }
748
753
  function removeMessages(uids, currentlyFocused) {
749
- const removeSet = new Set(uids.map((u) => `${u.accountId}:${u.uid}`));
750
- const focusedKey = currentlyFocused ? `${currentlyFocused.accountId}:${currentlyFocused.uid}` : null;
751
- const focusedWasRemoved = focusedKey !== null && removeSet.has(focusedKey);
754
+ const fullSet = /* @__PURE__ */ new Set();
755
+ const looseSet = /* @__PURE__ */ new Set();
756
+ for (const u of uids) {
757
+ if (u.folderId != null)
758
+ fullSet.add(`${u.accountId}:${u.folderId}:${u.uid}`);
759
+ else
760
+ looseSet.add(`${u.accountId}:${u.uid}`);
761
+ }
762
+ const isRemoved = (m) => m.folderId != null && fullSet.has(`${m.accountId}:${m.folderId}:${m.uid}`) || looseSet.has(`${m.accountId}:${m.uid}`);
763
+ const focusedWasRemoved = currentlyFocused !== null && isRemoved(currentlyFocused);
752
764
  let nextSurvivor = null;
753
765
  if (focusedWasRemoved) {
754
766
  let lastRemovedIdx = -1;
755
767
  for (let i = 0; i < messages.length; i++) {
756
- if (removeSet.has(`${messages[i].accountId}:${messages[i].uid}`))
768
+ if (isRemoved(messages[i]))
757
769
  lastRemovedIdx = i;
758
770
  }
759
771
  for (let i = lastRemovedIdx + 1; i < messages.length; i++) {
760
- if (!removeSet.has(`${messages[i].accountId}:${messages[i].uid}`)) {
772
+ if (!isRemoved(messages[i])) {
761
773
  nextSurvivor = messages[i];
762
774
  break;
763
775
  }
764
776
  }
765
777
  if (!nextSurvivor) {
766
778
  for (let i = lastRemovedIdx - 1; i >= 0; i--) {
767
- if (!removeSet.has(`${messages[i].accountId}:${messages[i].uid}`)) {
779
+ if (!isRemoved(messages[i])) {
768
780
  nextSurvivor = messages[i];
769
781
  break;
770
782
  }
@@ -773,11 +785,11 @@ function removeMessages(uids, currentlyFocused) {
773
785
  }
774
786
  const removedIds = /* @__PURE__ */ new Set();
775
787
  for (const m of messages) {
776
- if (removeSet.has(`${m.accountId}:${m.uid}`) && m.messageId) {
788
+ if (isRemoved(m) && m.messageId) {
777
789
  removedIds.add(m.messageId);
778
790
  }
779
791
  }
780
- messages = messages.filter((m) => !removeSet.has(`${m.accountId}:${m.uid}`));
792
+ messages = messages.filter((m) => !isRemoved(m));
781
793
  if (removedIds.size > 0) {
782
794
  for (const m of messages) {
783
795
  if (m.messageId && removedIds.has(m.messageId) && typeof m.dupeCount === "number") {
@@ -3161,18 +3173,18 @@ function updateSortIndicators() {
3161
3173
  });
3162
3174
  }
3163
3175
  function removeMessagesAndReconcile(uids) {
3164
- const focusedIdent = focusedRow ? { accountId: focusedRow.accountId, uid: focusedRow.msg.uid } : null;
3176
+ const focusedIdent = focusedRow ? { accountId: focusedRow.accountId, uid: focusedRow.msg.uid, folderId: focusedRow.msg.folderId } : null;
3165
3177
  const outcome = removeMessages(uids, focusedIdent);
3166
3178
  listCache.clear();
3167
3179
  const body = document.getElementById("ml-body");
3168
3180
  if (body) {
3169
- const stateUids = new Set(getMessages2().map((m) => `${m.accountId}:${m.uid}`));
3181
+ const stateUids = new Set(getMessages2().map((m) => `${m.accountId}:${m.folderId}:${m.uid}`));
3170
3182
  for (const row of Array.from(body.querySelectorAll(".ml-row"))) {
3171
3183
  const el = row;
3172
- const key = `${el.dataset.accountId}:${el.dataset.uid}`;
3184
+ const key = `${el.dataset.accountId}:${el.dataset.folderId}:${el.dataset.uid}`;
3173
3185
  if (!stateUids.has(key)) {
3174
- const dead = rowByKey.get(key);
3175
- if (dead)
3186
+ const dead = rowByKey.get(rowKey(el.dataset.accountId || "", Number(el.dataset.uid)));
3187
+ if (dead && dead.el === el)
3176
3188
  dead.detach();
3177
3189
  else
3178
3190
  el.remove();
@@ -8715,10 +8727,6 @@ function doSearch(immediate = false) {
8715
8727
  serverSearchTimer = null;
8716
8728
  }
8717
8729
  cancelServerSearch();
8718
- if (localScope === "current" && !serverOn && !immediate) {
8719
- setLiveFilter(query);
8720
- return;
8721
- }
8722
8730
  const localScopeEff = localScope === "current" ? "current" : "all";
8723
8731
  loadSearchResults(query, localScopeEff, currentAccountId3, currentFolderId2, includeTrash);
8724
8732
  setTitle(`${APP_NAME} - Search: ${query}`);
@@ -11175,7 +11183,7 @@ versionPromise.then((d) => {
11175
11183
  }).catch(() => {
11176
11184
  });
11177
11185
  if (isApp) {
11178
- let sendGeometry = function() {
11186
+ let sendGeometry2 = function() {
11179
11187
  if (!ipcApi?.saveWindowGeometry) return;
11180
11188
  ipcApi.saveWindowGeometry({
11181
11189
  x: window.screenX,
@@ -11185,12 +11193,12 @@ if (isApp) {
11185
11193
  }).catch(() => {
11186
11194
  });
11187
11195
  };
11188
- sendGeometry2 = sendGeometry;
11196
+ sendGeometry = sendGeometry2;
11189
11197
  const ipcApi = window.mailxapi;
11190
- window.addEventListener("beforeunload", sendGeometry);
11191
- setInterval(sendGeometry, 6e4);
11198
+ window.addEventListener("beforeunload", sendGeometry2);
11199
+ setInterval(sendGeometry2, 6e4);
11192
11200
  }
11193
- var sendGeometry2;
11201
+ var sendGeometry;
11194
11202
  function saveBootSnapshot() {
11195
11203
  try {
11196
11204
  const folderTree2 = document.getElementById("folder-tree");