@bobfrankston/mailx-store 0.1.44 → 0.1.45

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.
Files changed (2) hide show
  1. package/db.js +18 -4
  2. package/package.json +1 -1
package/db.js CHANGED
@@ -1683,7 +1683,12 @@ export class MailxDB {
1683
1683
  EXISTS(
1684
1684
  SELECT 1 FROM sync_actions sa
1685
1685
  WHERE sa.account_id = m.account_id AND sa.uid = r.mf_uid
1686
- ) AS pending
1686
+ ) AS pending,
1687
+ -- Replied state OR'd across the Message-ID group (see
1688
+ -- getUnifiedInbox) so the reply arrow is correct regardless of
1689
+ -- which duplicate survives dedup. Bob 2026-06-01.
1690
+ COALESCE((SELECT MAX(CASE WHEN m3.is_replied = 1 OR m3.flags_json LIKE '%Answered%' THEN 1 ELSE 0 END)
1691
+ FROM messages m3 WHERE m3.message_id = m.message_id AND COALESCE(m.message_id, '') != ''), m.is_replied) AS groupReplied
1687
1692
  FROM ranked r
1688
1693
  JOIN messages m ON m.id = r.m_id
1689
1694
  WHERE r.rn = 1
@@ -1706,7 +1711,7 @@ export class MailxDB {
1706
1711
  flags: JSON.parse(r.flags_json),
1707
1712
  size: r.size,
1708
1713
  hasAttachments: !!r.has_attachments,
1709
- isReplied: !!r.is_replied,
1714
+ isReplied: !!r.groupReplied,
1710
1715
  preview: r.preview,
1711
1716
  bodyPath: r.body_path || "",
1712
1717
  pending: !!r.pending,
@@ -1754,7 +1759,16 @@ export class MailxDB {
1754
1759
  WHERE sa.account_id = m.account_id AND sa.uid = r.mf_uid
1755
1760
  ) AS pending,
1756
1761
  (SELECT COUNT(DISTINCT account_id) FROM messages m2
1757
- WHERE m2.message_id = m.message_id AND COALESCE(m.message_id, '') != '') AS dupeCount
1762
+ WHERE m2.message_id = m.message_id AND COALESCE(m.message_id, '') != '') AS dupeCount,
1763
+ -- Replied state aggregated across the whole Message-ID group, not
1764
+ -- just the dedup survivor. When duplicates collapse (same message
1765
+ -- delivered to multiple self-addresses), the \Answered flag /
1766
+ -- is_replied can live on a NON-surviving copy — so the survivor
1767
+ -- showed no reply arrow even though TB did. OR it across the group
1768
+ -- so the marker is correct regardless of which row wins dedup
1769
+ -- (Bob 2026-06-01). Empty message_id → falls back to the row's own.
1770
+ COALESCE((SELECT MAX(CASE WHEN m3.is_replied = 1 OR m3.flags_json LIKE '%Answered%' THEN 1 ELSE 0 END)
1771
+ FROM messages m3 WHERE m3.message_id = m.message_id AND COALESCE(m.message_id, '') != ''), m.is_replied) AS groupReplied
1758
1772
  FROM ranked r
1759
1773
  JOIN messages m ON m.id = r.m_id
1760
1774
  WHERE r.rn = 1
@@ -1776,7 +1790,7 @@ export class MailxDB {
1776
1790
  flags: JSON.parse(r.flags_json),
1777
1791
  size: r.size,
1778
1792
  hasAttachments: !!r.has_attachments,
1779
- isReplied: !!r.is_replied,
1793
+ isReplied: !!r.groupReplied,
1780
1794
  preview: r.preview,
1781
1795
  bodyPath: r.body_path || "",
1782
1796
  pending: !!r.pending,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx-store",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",