From b20ba9cfccd22159bf8263165cca76aab3147d9c Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Tue, 30 Dec 2025 13:29:03 +0200 Subject: feat: add "URL Does Not Contain" condition to rule engine (#2280) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add "URL Does Not Contain" condition to rule engine Add a new condition type `urlDoesNotContain` that allows users to create rules based on URLs that do NOT contain specific strings. This enables more flexible rule configurations, such as: - Automatically adding bookmarks to a "Read Later" list if the URL does not contain "reddit.com" or "youtube.com" Changes: - Added `urlDoesNotContain` condition type to Zod schema - Implemented evaluation logic in RuleEngine - Added UI support in ConditionBuilder component - Added translation key for new condition type - Added test coverage for the new condition Fixes #2259 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Mohamed Bassem * fix type link --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Mohamed Bassem --- packages/trpc/lib/__tests__/ruleEngine.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'packages/trpc/lib/__tests__/ruleEngine.test.ts') diff --git a/packages/trpc/lib/__tests__/ruleEngine.test.ts b/packages/trpc/lib/__tests__/ruleEngine.test.ts index ede22ec6..600d8aa9 100644 --- a/packages/trpc/lib/__tests__/ruleEngine.test.ts +++ b/packages/trpc/lib/__tests__/ruleEngine.test.ts @@ -219,6 +219,22 @@ describe("RuleEngine", () => { expect(engine.doesBookmarkMatchConditions(condition)).toBe(false); }); + it("should return false for urlDoesNotContain condition when URL contains string", () => { + const condition: RuleEngineCondition = { + type: "urlDoesNotContain", + str: "example.com", + }; + expect(engine.doesBookmarkMatchConditions(condition)).toBe(false); + }); + + it("should return true for urlDoesNotContain condition when URL does not contain string", () => { + const condition: RuleEngineCondition = { + type: "urlDoesNotContain", + str: "nonexistent", + }; + expect(engine.doesBookmarkMatchConditions(condition)).toBe(true); + }); + it("should return true for importedFromFeed condition", () => { const condition: RuleEngineCondition = { type: "importedFromFeed", -- cgit v1.2.3-70-g09d2