Files
sure/test
e3220de2e4 feat(transactions): add "No merchant"/"Untagged" filter options (#3135)
* feat(transactions): add "No merchant"/"Untagged" filter options

Extends the existing "Uncategorized" filter pattern to the merchant
and tag filters on the transactions page, closing discussions #3118
and #3117.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(transactions): avoid PG DISTINCT/ORDER error and name collisions in No merchant/Untagged filters

- Replace the top-level .distinct on the Untagged branch with an id
  subquery, since PostgreSQL rejects a DISTINCT select combined with
  reverse_chronological's CASE-expression ORDER BY unless that
  expression is also in the select list (PG::InvalidColumnReference).
- Switch both filters from matching on the localized display name to a
  stable, non-localized sentinel value (Merchant::NO_MERCHANT_FILTER_VALUE,
  Tag::UNTAGGED_FILTER_VALUE), so a real merchant/tag that happens to be
  named "No merchant"/"Untagged" (or a translation of either) can no
  longer be misdetected as the synthetic filter option. This also drops
  the per-locale I18n lookup previously needed for locale-safe detection.
- Add a badge special case so the filter chip still shows the
  translated label instead of the raw sentinel.

Addresses review feedback from chatgpt-codex-connector and
coderabbitai on PR #3135.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(transactions): reserve sentinel filter values and move value selection into models

- Merchant/Tag now reject a name equal to their own sentinel value
  (NO_MERCHANT_FILTER_VALUE / UNTAGGED_FILTER_VALUE), closing the
  remaining collision where a merchant or tag literally named
  "__no_merchant__"/"__untagged__" would be misdetected as the
  synthetic filter option.
- Added Merchant#filter_value / Tag#filter_value so the
  persisted-vs-synthetic checkbox value is computed in the model
  instead of the view template, per CodeRabbit's nitpick and this
  repo's "domain logic out of views" convention.

Addresses further review feedback from chatgpt-codex-connector and
coderabbitai on PR #3135.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(transactions): scope the Untagged id subquery to the current family

Transaction.left_joins(:tags) queried across every family's
transactions/taggings/tags before being intersected with the
family-scoped outer query. Functionally correct (the outer query still
restricted results to the right family), but it meant every request
selecting "Untagged" ran a join across the whole platform's data
instead of just the current family's, unlike every other filter in
this file. Use family.transactions.left_joins(:tags) instead.

Reported by jjmata on PR #3135.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(transactions): use token-backed fallback color for No merchant icon

Merchant.no_merchant hardcoded #737373 into DS::FilledIcon instead of
letting its token-backed default (var(--color-gray-500)) apply, bypassing
theme changes.

---------

Co-authored-by: Gerald <248542187+gfr-free@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-08 09:06:27 +02:00
..