[PR #6088] [WIP] Add 'contains' operator for payee rule conditions #20678

Closed
opened 2026-04-14 21:42:35 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/6088

State: closed
Merged: No


Description

This PR adds support for substring matching on payee names in transaction rules using the 'contains' and 'does not contain' operators.

Closes #2525

Problem

Users with bank imports that include varying transaction IDs in payee names (e.g., "Merchant #12345", "Merchant #12346") had to create separate rules for each payee variant. This was inefficient and could result in many orphaned payees in the system.

Solution

Enable the existing backend 'contains' operator for the payee field in the UI, allowing users to create rules with text patterns instead of exact payee IDs.

Changes

Backend (loot-core):

  • Modified Condition.eval() in packages/loot-core/src/server/rules/condition.ts to use payee_name (string) instead of payee (ID) when evaluating string-based operators (contains, doesNotContain, matches)

Frontend (desktop-client):

  • Updated OpSelect component to accept field prop and allow 'contains'/'doesNotContain' for payee field only
  • Modified ConditionEditor to use text input instead of payee autocomplete for payee substring matching
  • Updated value input logic to route payee contains conditions through imported_payee field for text rendering

Tests:

  • Added 5 unit tests in packages/loot-core/src/server/rules/index.test.ts
  • Added 2 integration tests in packages/loot-core/src/server/transactions/transaction-rules.test.ts

Release Notes:

  • Added entry in upcoming-release-notes/6088.md describing the feature

Testing Status

All 8 test packages passed
TypeScript type checking: All 1255 files passed
Linting: Passing
Backwards compatible: No breaking changes
Database schema: Unchanged

**Original Pull Request:** https://github.com/actualbudget/actual/pull/6088 **State:** closed **Merged:** No --- ## Description This PR adds support for substring matching on payee names in transaction rules using the 'contains' and 'does not contain' operators. Closes #2525 ## Problem Users with bank imports that include varying transaction IDs in payee names (e.g., "Merchant #12345", "Merchant #12346") had to create separate rules for each payee variant. This was inefficient and could result in many orphaned payees in the system. ## Solution Enable the existing backend 'contains' operator for the payee field in the UI, allowing users to create rules with text patterns instead of exact payee IDs. ## Changes **Backend (`loot-core`):** - Modified `Condition.eval()` in `packages/loot-core/src/server/rules/condition.ts` to use `payee_name` (string) instead of `payee` (ID) when evaluating string-based operators (`contains`, `doesNotContain`, `matches`) **Frontend (`desktop-client`):** - Updated `OpSelect` component to accept `field` prop and allow 'contains'/'doesNotContain' for payee field only - Modified `ConditionEditor` to use text input instead of payee autocomplete for payee substring matching - Updated value input logic to route payee contains conditions through `imported_payee` field for text rendering **Tests:** - Added 5 unit tests in `packages/loot-core/src/server/rules/index.test.ts` - Added 2 integration tests in `packages/loot-core/src/server/transactions/transaction-rules.test.ts` **Release Notes:** - Added entry in `upcoming-release-notes/6088.md` describing the feature ## Testing Status ✅ All 8 test packages passed ✅ TypeScript type checking: All 1255 files passed ✅ Linting: Passing ✅ Backwards compatible: No breaking changes ✅ Database schema: Unchanged
GiteaMirror added the pull-request label 2026-04-14 21:42:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#20678