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

Closed
opened 2026-04-23 13:34:10 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/6088
Author: @tazomatalax
Created: 11/8/2025
Status: Closed

Base: masterHead: feature/payee-contains-operator


📝 Commits (1)

  • ad0ac2e feat: Add 'contains' operator for payee rule conditions

📊 Changes

5 files changed (+234 additions, -11 deletions)

View changed files

📝 packages/desktop-client/src/components/rules/RuleEditor.tsx (+28 -11)
📝 packages/loot-core/src/server/rules/condition.ts (+8 -0)
📝 packages/loot-core/src/server/rules/index.test.ts (+99 -0)
📝 packages/loot-core/src/server/transactions/transaction-rules.test.ts (+73 -0)
upcoming-release-notes/6088.md (+26 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/6088 **Author:** [@tazomatalax](https://github.com/tazomatalax) **Created:** 11/8/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feature/payee-contains-operator` --- ### 📝 Commits (1) - [`ad0ac2e`](https://github.com/actualbudget/actual/commit/ad0ac2eeb842718bd729e37f1be414e0cbe7ad0a) feat: Add 'contains' operator for payee rule conditions ### 📊 Changes **5 files changed** (+234 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/components/rules/RuleEditor.tsx` (+28 -11) 📝 `packages/loot-core/src/server/rules/condition.ts` (+8 -0) 📝 `packages/loot-core/src/server/rules/index.test.ts` (+99 -0) 📝 `packages/loot-core/src/server/transactions/transaction-rules.test.ts` (+73 -0) ➕ `upcoming-release-notes/6088.md` (+26 -0) </details> ### 📄 Description ## 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 13:34:10 -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#40746