@bobfrankston/mailx 1.0.348 → 1.0.349

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.
@@ -266,8 +266,13 @@ export async function loadSearchResults(query, scope = "all", accountId = "", fo
266
266
  export async function loadMessages(accountId, folderId, page = 1, specialUse = "", autoSelect = true) {
267
267
  searchMode = false;
268
268
  unifiedMode = false;
269
- showToInsteadOfFrom = ["sent", "drafts", "outbox"].includes(specialUse) ||
270
- ["Sent", "Drafts", "Outbox", "Sent Items"].includes(specialUse);
269
+ // specialUse is either the DB tag ("sent"/"drafts"/"outbox") or the
270
+ // folder path lowercased (folder-tree fallback when tag is missing — common
271
+ // on Dovecot which doesn't advertise \Sent). Match both cases.
272
+ const su = (specialUse || "").toLowerCase();
273
+ showToInsteadOfFrom = su === "sent" || su === "drafts" || su === "outbox"
274
+ || su.endsWith("sent") || su.endsWith("drafts") || su.endsWith("outbox")
275
+ || su === "sent items" || su === "sent mail" || su.endsWith("/sent items") || su.endsWith(".sent items");
271
276
  currentAccountId = accountId;
272
277
  currentFolderId = folderId;
273
278
  currentPage = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx",
3
- "version": "1.0.348",
3
+ "version": "1.0.349",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -20,7 +20,7 @@
20
20
  "postinstall": "node bin/postinstall.js"
21
21
  },
22
22
  "dependencies": {
23
- "@bobfrankston/iflow-direct": "^0.1.23",
23
+ "@bobfrankston/iflow-direct": "^0.1.24",
24
24
  "@bobfrankston/iflow-node": "^0.1.7",
25
25
  "@bobfrankston/miscinfo": "^1.0.9",
26
26
  "@bobfrankston/oauthsupport": "^1.0.24",
@@ -84,7 +84,7 @@
84
84
  },
85
85
  ".transformedSnapshot": {
86
86
  "dependencies": {
87
- "@bobfrankston/iflow-direct": "^0.1.23",
87
+ "@bobfrankston/iflow-direct": "^0.1.24",
88
88
  "@bobfrankston/iflow-node": "^0.1.7",
89
89
  "@bobfrankston/miscinfo": "^1.0.9",
90
90
  "@bobfrankston/oauthsupport": "^1.0.24",
@@ -694,22 +694,19 @@ export class MailxService {
694
694
  /** Move messages to the account's configured spam folder (accounts.jsonc "spam" path).
695
695
  * Throws if the account has no spam folder configured or the folder doesn't exist locally. */
696
696
  async markAsSpamMessages(accountId, uids) {
697
- // Cached accounts same reason as send/saveDraft: a stalled GDrive
698
- // mount could turn `Mark as spam` into a 120s IPC timeout.
699
- let account = this.getCachedAccounts().find(a => a.id === accountId);
700
- if (!account) {
701
- this._accountsCache = null;
702
- account = this.getCachedAccounts().find(a => a.id === accountId);
703
- }
704
- if (!account)
705
- throw new Error(`Account ${accountId} not found`);
706
- const spamPath = account.spam;
707
- if (!spamPath)
708
- throw new Error(`Account ${accountId} has no "spam" folder configured`);
697
+ // The spam folder is whatever the provider's getSpecialFolders() said
698
+ // it is. iflow-direct's compat client fills this in from RFC 6154
699
+ // \Junk / \Spam flags (with sensible defaults if the server doesn't
700
+ // advertise them); Gmail has SPAM built in. mailx stores the result
701
+ // as `specialUse: "junk"` on the matching folder row.
702
+ //
703
+ // Earlier versions required an explicit `spam:` field in accounts.jsonc
704
+ // and the button erroring out when that was absent. That's obsolete —
705
+ // the provider knows where spam goes. Just look up the flagged folder.
709
706
  const folders = this.db.getFolders(accountId);
710
- const target = folders.find(f => f.path.toLowerCase() === spamPath.toLowerCase());
707
+ const target = folders.find(f => f.specialUse === "junk");
711
708
  if (!target)
712
- throw new Error(`Spam folder "${spamPath}" not found in ${accountId}`);
709
+ throw new Error(`No \\Junk/\\Spam folder found for ${accountId}`);
713
710
  await this.moveMessages(accountId, uids, target.id);
714
711
  return { targetFolderId: target.id, moved: uids.length };
715
712
  }