Skip to content

The open alternative to Salesforce, designed for AI.

feat(filter): add case-sensitive IS/IS_NOT operands for TEXT fields (#29201)

Etienne88df1a7eb572
diff --git a/packages/twenty-cli/src/app/manifest/utils/__tests__/validate-view-filter-operands.spec.ts b/packages/twenty-cli/src/app/manifest/utils/__tests__/validate-view-filter-operands.spec.ts
index 3e3a222e066..45b2198817e 100644
--- a/packages/twenty-cli/src/app/manifest/utils/__tests__/validate-view-filter-operands.spec.ts
+++ b/packages/twenty-cli/src/app/manifest/utils/__tests__/validate-view-filter-operands.spec.ts
@@ -100,6 +100,34 @@ describe('validateViewFilterOperands', () => {
expect(errors).toEqual([]);
});
+ it.each([ViewFilterOperand.IS, ViewFilterOperand.IS_NOT])(
+ 'should accept %s on a TEXT field',
+ (operand) => {
+ const errors = validateViewFilterOperands({
+ views: [
+ buildView([
+ {
+ universalIdentifier: 'filter-uid',
+ fieldMetadataUniversalIdentifier: 'field-uid',
+ operand,
+ value: 'Acme',
+ },
+ ]),
+ ],
+ objects: [],
+ fields: [
+ buildField({
+ universalIdentifier: 'field-uid',
+ type: FieldMetadataType.TEXT,
+ name: 'company',
+ }),
+ ],
+ });
+
+ expect(errors).toEqual([]);
+ },
+ );
+
it('should return an error when operand is invalid for the field type', () => {
const errors = validateViewFilterOperands({
views: [
diff --git a/packages/twenty-docs/developers/extend/apps/layout/views.mdx b/packages/twenty-docs/developers/extend/apps/layout/views.mdx
index daf7cc40dcd..e320a60acc0 100644
--- a/packages/twenty-docs/developers/extend/apps/layout/views.mdx
+++ b/packages/twenty-docs/developers/extend/apps/layout/views.mdx
@@ -89,7 +89,8 @@ Three optional properties refine a filter:
| Field type | Supported operands |
| -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
-| `TEXT`, `EMAILS`, `FULL_NAME`, `ADDRESS`, `LINKS`, `PHONES`, `RAW_JSON`, `FILES`, `ACTOR`, `ARRAY` | `CONTAINS`, `DOES_NOT_CONTAIN`, `IS_EMPTY`, `IS_NOT_EMPTY` |
+| `TEXT` | `CONTAINS`, `DOES_NOT_CONTAIN`, `IS`, `IS_NOT`, `IS_EMPTY`, `IS_NOT_EMPTY` |
+| `EMAILS`, `FULL_NAME`, `ADDRESS`, `LINKS`, `PHONES`, `RAW_JSON`, `FILES`, `ACTOR`, `ARRAY` | `CONTAINS`, `DOES_NOT_CONTAIN`, `IS_EMPTY`, `IS_NOT_EMPTY` |
| `ACTOR.source`, `ACTOR.workspaceMemberId` | `IS`, `IS_NOT`, `IS_EMPTY`, `IS_NOT_EMPTY` |
| `SELECT` | `IS`, `IS_NOT`, `IS_EMPTY`, `IS_NOT_EMPTY` |
| `MULTI_SELECT` | `CONTAINS`, `DOES_NOT_CONTAIN`, `IS_EMPTY`, `IS_NOT_EMPTY` |
@@ -115,6 +116,7 @@ The `value` field is always a JSON-serializable value, but its expected shape de
| `CONTAINS`, `DOES_NOT_CONTAIN` on `MULTI_SELECT` | array of option keys (strings) | `['TAG_A']` |
| `IS`, `IS_NOT` on `RELATION` | array of record IDs (uuids) | `['c5a1...']` |
| `CONTAINS`, `DOES_NOT_CONTAIN` on text-like fields | string | `'acme'` |
+| `IS`, `IS_NOT` on `TEXT` | string (exact, case-sensitive) | `'Acme'` |
| `IS`, `IS_NOT` on `NUMBER` | string (the value) | `'5'` |
| `IS` on `RATING` / `UUID` | string (the value) | `'5'` |
| `GREATER_THAN_OR_EQUAL`, `LESS_THAN_OR_EQUAL` | string (the bound) | `'10'` |
diff --git a/packages/twenty-front/src/modules/object-core/agents/utils/__tests__/isCoreAgentMatchingFilterSettings.test.ts b/packages/twenty-front/src/modules/object-core/agents/utils/__tests__/isCoreAgentMatchingFilterSettings.test.ts
index 00706bb4963..b3fe9066fcc 100644
--- a/packages/twenty-front/src/modules/object-core/agents/utils/__tests__/isCoreAgentMatchingFilterSettings.test.ts
+++ b/packages/twenty-front/src/modules/object-core/agents/utils/__tests__/isCoreAgentMatchingFilterSettings.test.ts
@@ -80,6 +80,48 @@ describe('isCoreAgentMatchingFilterSettings', () => {
).toBe(false);
});
+ it('should match names exactly and case sensitively with IS', () => {
+ const filterSettings = {
+ stepFilters: [
+ buildNameStepFilter({
+ operand: ViewFilterOperand.IS,
+ value: 'Lead qualifier',
+ }),
+ ],
+ };
+
+ expect(
+ isCoreAgentMatchingFilterSettings({ agent: userAgent, filterSettings }),
+ ).toBe(true);
+ expect(
+ isCoreAgentMatchingFilterSettings({ agent: systemAgent, filterSettings }),
+ ).toBe(false);
+ expect(
+ isCoreAgentMatchingFilterSettings({
+ agent: buildAgent({ label: 'lead qualifier' }),
+ filterSettings,
+ }),
+ ).toBe(false);
+ });
+
+ it('should leave out the exact name with IS_NOT', () => {
+ const filterSettings = {
+ stepFilters: [
+ buildNameStepFilter({
+ operand: ViewFilterOperand.IS_NOT,
+ value: 'Lead qualifier',
+ }),
+ ],
+ };
+
+ expect(
+ isCoreAgentMatchingFilterSettings({ agent: userAgent, filterSettings }),
+ ).toBe(false);
+ expect(
+ isCoreAgentMatchingFilterSettings({ agent: systemAgent, filterSettings }),
+ ).toBe(true);
+ });
+
it('should honor the root logical operator', () => {
const [systemStepFilter] =
CORE_AGENTS_DEFAULT_FILTER_SETTINGS.stepFilters ?? [];
diff --git a/packages/twenty-front/src/modules/object-core/agents/utils/isCoreAgentMatchingFilterSettings.ts b/packages/twenty-front/src/modules/object-core/agents/utils/isCoreAgentMatchingFilterSettings.ts
index fde0313b030..eab2cecc34a 100644
--- a/packages/twenty-front/src/modules/object-core/agents/utils/isCoreAgentMatchingFilterSettings.ts
+++ b/packages/twenty-front/src/modules/object-core/agents/utils/isCoreAgentMatchingFilterSettings.ts
@@ -29,6 +29,10 @@ const isCoreAgentMatchingRule = ({
return normalizedLabel.includes(normalizedValue);
case ViewFilterOperand.DOES_NOT_CONTAIN:
return !normalizedLabel.includes(normalizedValue);
+ case ViewFilterOperand.IS:
+ return agent.label === stepFilter.value;
+ case ViewFilterOperand.IS_NOT:
+ return agent.label !== stepFilter.value;
case ViewFilterOperand.IS_EMPTY:
return normalizedLabel === '';
case ViewFilterOperand.IS_NOT_EMPTY:
diff --git a/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand.ts b/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand.ts
index b0083b7c1b5..9b227a1da66 100644
--- a/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand.ts
+++ b/packages/twenty-front/src/modules/object-core/workflows/constants/CoreWorkflowFilterOperandByViewFilterOperand.ts
@@ -9,6 +9,7 @@ export const CORE_WORKFLOW_FILTER_OPERAND_BY_VIEW_FILTER_OPERAND: Partial<
[ViewFilterOperand.DOES_NOT_CONTAIN]:
CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,
[ViewFilterOperand.IS]: CoreWorkflowFilterOperand.IS,
+ [ViewFilterOperand.IS_NOT]: CoreWorkflowFilterOperand.IS_NOT,
[ViewFilterOperand.IS_EMPTY]: CoreWorkflowFilterOperand.IS_EMPTY,
[ViewFilterOperand.IS_NOT_EMPTY]: CoreWorkflowFilterOperand.IS_NOT_EMPTY,
[ViewFilterOperand.IS_BEFORE]: CoreWorkflowFilterOperand.IS_BEFORE,
diff --git a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getOperandsForFilterType.test.ts b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getOperandsForFilterType.test.ts
index ecc0b47c9d7..629845db9df 100644
--- a/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getOperandsForFilterType.test.ts
+++ b/packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getOperandsForFilterType.test.ts
@@ -51,8 +51,14 @@ describe('getOperandsForFilterType', () => {
const relationOperand = [RecordFilterOperand.IS, RecordFilterOperand.IS_NOT];
+ const textOperands = [
+ ...containsOperands,
+ RecordFilterOperand.IS,
+ RecordFilterOperand.IS_NOT,
+ ];
+
const testCases = [
- ['TEXT', [...containsOperands, ...emptyOperands]],
+ ['TEXT', [...textOperands, ...emptyOperands]],
['FULL_NAME', [...containsOperands, ...emptyOperands]],
['ADDRESS', [...containsOperands, ...emptyOperands]],
['LINKS', [...containsOperands, ...emptyOperands]],
diff --git a/packages/twenty-front/src/modules/object-record/record-filter/utils/__tests__/__snapshots__/getRecordFilterOperands.test.ts.snap b/packages/twenty-front/src/modules/object-record/record-filter/utils/__tests__/__snapshots__/getRecordFilterOperands.test.ts.snap
index 17fbc54c77a..803a93041ca 100644
--- a/packages/twenty-front/src/modules/object-record/record-filter/utils/__tests__/__snapshots__/getRecordFilterOperands.test.ts.snap
+++ b/packages/twenty-front/src/modules/object-record/record-filter/utils/__tests__/__snapshots__/getRecordFilterOperands.test.ts.snap
@@ -217,6 +217,8 @@ exports[`getRecordFilterOperands returns the expected operands for filterType=TE
[
"CONTAINS",
"DOES_NOT_CONTAIN",
+ "IS",
+ "IS_NOT",
"IS_EMPTY",
"IS_NOT_EMPTY",
]
diff --git a/packages/twenty-front/src/modules/object-record/record-table/utils/__tests__/buildValueFromFilter.spec.ts b/packages/twenty-front/src/modules/object-record/record-table/utils/__tests__/buildValueFromFilter.spec.ts
index d54e4930e9c..6c7288be9fc 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/utils/__tests__/buildValueFromFilter.spec.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/utils/__tests__/buildValueFromFilter.spec.ts
@@ -47,6 +47,16 @@ describe('buildValueFromFilter', () => {
value: 'test',
expected: undefined,
},
+ {
+ operand: ViewFilterOperand.IS,
+ value: 'test',
+ expected: 'test',
+ },
+ {
+ operand: ViewFilterOperand.IS_NOT,
+ value: 'test',
+ expected: undefined,
+ },
{
operand: ViewFilterOperand.IS_NOT_EMPTY,
value: 'test',
diff --git a/packages/twenty-front/src/modules/object-record/record-table/utils/buildValueFromFilter.ts b/packages/twenty-front/src/modules/object-record/record-table/utils/buildValueFromFilter.ts
index 89705c93107..ae7f74c54ab 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/utils/buildValueFromFilter.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/utils/buildValueFromFilter.ts
@@ -93,6 +93,24 @@ const computeValueFromContainsOperand = (
}
};
+const computeValueFromFilterText = (
+ operand: RecordFilterToRecordInputOperand<'TEXT'>,
+ value: string,
+) => {
+ switch (operand) {
+ case ViewFilterOperand.CONTAINS:
+ case ViewFilterOperand.IS:
+ case ViewFilterOperand.IS_NOT_EMPTY:
+ return value;
+ case ViewFilterOperand.DOES_NOT_CONTAIN:
+ case ViewFilterOperand.IS_NOT:
+ case ViewFilterOperand.IS_EMPTY:
+ return undefined;
+ default:
+ assertUnreachable(operand);
+ }
+};
+
const filterDateTimeToInstant = (
value: string,
timeZone: string,
@@ -319,7 +337,10 @@ const computeValueFromFilterUUID = (
const VALUE_HANDLER_REGISTRY: Partial<Record<FieldMetadataType, ValueHandler>> =
{
[FieldMetadataType.TEXT]: ({ operand, value }) =>
- computeValueFromContainsOperand(operand as ContainsBasedOperand, value),
+ computeValueFromFilterText(
+ operand as RecordFilterToRecordInputOperand<'TEXT'>,
+ value,
+ ),
[FieldMetadataType.ARRAY]: ({ operand, value }) =>
computeValueFromContainsOperand(operand as ContainsBasedOperand, value),
[FieldMetadataType.RAW_JSON]: ({ operand, value }) =>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/__tests__/__snapshots__/getStepFilterOperands.test.ts.snap b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/__tests__/__snapshots__/getStepFilterOperands.test.ts.snap
index 694017b9efe..9a604fb5982 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/__tests__/__snapshots__/getStepFilterOperands.test.ts.snap
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/__tests__/__snapshots__/getStepFilterOperands.test.ts.snap
@@ -228,6 +228,8 @@ exports[`getStepFilterOperands returns the expected operands for filterType=TEXT
[
"CONTAINS",
"DOES_NOT_CONTAIN",
+ "IS",
+ "IS_NOT",
"IS_EMPTY",
"IS_NOT_EMPTY",
]
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/getStepFilterOperands.ts b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/getStepFilterOperands.ts
index 938941fc882..b5018d36dca 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/getStepFilterOperands.ts
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/filters/utils/getStepFilterOperands.ts
@@ -24,12 +24,17 @@ export const getStepFilterOperands = ({
}): readonly ViewFilterOperand[] => {
switch (filterType) {
case 'TEXT':
+ return FILTER_OPERANDS_MAP.TEXT;
case 'EMAILS':
+ return FILTER_OPERANDS_MAP.EMAILS;
case 'FULL_NAME':
+ return FILTER_OPERANDS_MAP.FULL_NAME;
case 'ADDRESS':
+ return FILTER_OPERANDS_MAP.ADDRESS;
case 'LINKS':
+ return FILTER_OPERANDS_MAP.LINKS;
case 'PHONES':
- return FILTER_OPERANDS_MAP.TEXT;
+ return FILTER_OPERANDS_MAP.PHONES;
case 'CURRENCY': {
if (subFieldName === 'currencyCode') {
return COMPOSITE_FIELD_FILTER_OPERANDS_MAP.CURRENCY.currencyCode;
@@ -69,7 +74,7 @@ export const getStepFilterOperands = ({
} else if (subFieldName === 'workspaceMemberId') {
return FILTER_OPERANDS_MAP.RELATION;
}
- return FILTER_OPERANDS_MAP.TEXT;
+ return FILTER_OPERANDS_MAP.ACTOR;
}
default:
return defaultOperands;
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-filter-predicate.util.spec.ts b/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-filter-predicate.util.spec.ts
index 01de1ef3b59..c0b75baeea0 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-filter-predicate.util.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/utils/__tests__/build-core-workflow-filter-predicate.util.spec.ts
@@ -126,22 +126,50 @@ describe('buildCoreWorkflowFilterPredicate', () => {
});
});
- it('should reject IS and IS_NOT, which the builder does not offer on NAME', () => {
- for (const operand of [
- CoreWorkflowFilterOperand.IS,
- CoreWorkflowFilterOperand.IS_NOT,
- ]) {
- expect(() =>
+ it('should build a case-sensitive equality predicate for IS', () => {
+ expect(
+ buildPredicate([
+ {
+ fieldKey: CoreWorkflowFilterFieldKey.NAME,
+ operand: CoreWorkflowFilterOperand.IS,
+ value: 'Send invoice',
+ },
+ ]),
+ ).toEqual({
+ predicate: `(c.name = $2)`,
+ parameters: ['Send invoice'],
+ });
+ });
+
+ it('should let an unnamed workflow match IS_NOT', () => {
+ expect(
+ buildPredicate([
+ {
+ fieldKey: CoreWorkflowFilterFieldKey.NAME,
+ operand: CoreWorkflowFilterOperand.IS_NOT,
+ value: 'Send invoice',
+ },
+ ]),
+ ).toEqual({
+ predicate: `((c.name IS NULL OR c.name <> $2))`,
+ parameters: ['Send invoice'],
+ });
+ });
+
+ it.each([CoreWorkflowFilterOperand.IS, CoreWorkflowFilterOperand.IS_NOT])(
+ 'should keep surrounding whitespace in the %s value',
+ (operand) => {
+ expect(
buildPredicate([
{
fieldKey: CoreWorkflowFilterFieldKey.NAME,
operand,
- value: 'Send invoice',
+ value: ' Send invoice ',
},
- ]),
- ).toThrow(UserInputError);
- }
- });
+ ]).parameters,
+ ).toEqual([' Send invoice ']);
+ },
+ );
it('should treat a blank name as empty', () => {
expect(
@@ -172,6 +200,8 @@ describe('buildCoreWorkflowFilterPredicate', () => {
it.each([
CoreWorkflowFilterOperand.CONTAINS,
CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,
+ CoreWorkflowFilterOperand.IS,
+ CoreWorkflowFilterOperand.IS_NOT,
])('should reject %s without a value', (operand) => {
expect(() =>
buildPredicate([
@@ -573,6 +603,8 @@ describe('buildCoreWorkflowFilterPredicate', () => {
[CoreWorkflowFilterFieldKey.NAME]: [
CoreWorkflowFilterOperand.CONTAINS,
CoreWorkflowFilterOperand.DOES_NOT_CONTAIN,
+ CoreWorkflowFilterOperand.IS,
+ CoreWorkflowFilterOperand.IS_NOT,
CoreWorkflowFilterOperand.IS_EMPTY,
CoreWorkflowFilterOperand.IS_NOT_EMPTY,
],
diff --git a/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util.ts b/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util.ts
index dfd8c21894d..d2b70589808 100644
--- a/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/workflow/utils/build-core-workflow-filter-predicate.util.ts
@@ -42,18 +42,19 @@ export type CoreWorkflowFilterPredicate = {
parameters: unknown[];
};
-const requireTextValue = (rule: CoreWorkflowFilterRuleInput): string => {
- const trimmedValue = rule.value?.trim();
-
- if (!isNonEmptyString(trimmedValue)) {
+const requireExactTextValue = (rule: CoreWorkflowFilterRuleInput): string => {
+ if (!isNonEmptyString(rule.value) || rule.value.trim() === '') {
throw new UserInputError(
`Operand ${rule.operand} on field ${rule.fieldKey} requires a value`,
);
}
- return trimmedValue;
+ return rule.value;
};
+const requireTextValue = (rule: CoreWorkflowFilterRuleInput): string =>
+ requireExactTextValue(rule).trim();
+
const parseJsonValue = (value: string): unknown => {
try {
return JSON.parse(value);
@@ -257,8 +258,10 @@ const PREDICATE_BUILDER_BY_OPERAND_BY_FIELD_KEY: Record<
pattern: `%${escapeForIlike(requireTextValue(rule))}%`,
negated: true,
}),
- [CoreWorkflowFilterOperand.IS]: null,
- [CoreWorkflowFilterOperand.IS_NOT]: null,
+ [CoreWorkflowFilterOperand.IS]: ({ rule, bindParameter }) =>
+ `${NAME_COLUMN} = ${bindParameter(requireExactTextValue(rule))}`,
+ [CoreWorkflowFilterOperand.IS_NOT]: ({ rule, bindParameter }) =>
+ `(${NAME_COLUMN} IS NULL OR ${NAME_COLUMN} <> ${bindParameter(requireExactTextValue(rule))})`,
[CoreWorkflowFilterOperand.IS_EMPTY]: () =>
`(${NAME_COLUMN} IS NULL OR ${NAME_COLUMN} = '')`,
[CoreWorkflowFilterOperand.IS_NOT_EMPTY]: () =>
diff --git a/packages/twenty-server/src/engine/metadata-modules/view-filter/tools/schemas/create-view-filter-input.schema.ts b/packages/twenty-server/src/engine/metadata-modules/view-filter/tools/schemas/create-view-filter-input.schema.ts
index 59f350383c1..a50e8ca2c8e 100644
--- a/packages/twenty-server/src/engine/metadata-modules/view-filter/tools/schemas/create-view-filter-input.schema.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/view-filter/tools/schemas/create-view-filter-input.schema.ts
@@ -12,7 +12,7 @@ export const createViewFilterInputSchema = z.object({
operand: z
.enum(ViewFilterOperand)
.describe(
- 'Filter operator. Valid operators per field type — TEXT/EMAILS/FULL_NAME: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. NUMBER/NUMERIC: IS, IS_NOT, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. CURRENCY: GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. DATE/DATE_TIME: IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY. SELECT: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. MULTI_SELECT/ARRAY: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. RELATION: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. BOOLEAN: IS.',
+ 'Filter operator. Valid operators per field type — TEXT: CONTAINS, DOES_NOT_CONTAIN, IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. EMAILS/FULL_NAME: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. NUMBER/NUMERIC: IS, IS_NOT, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. CURRENCY: GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. DATE/DATE_TIME: IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY. SELECT: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. MULTI_SELECT/ARRAY: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. RELATION: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. BOOLEAN: IS.',
),
value: z
.union([
diff --git a/packages/twenty-server/src/engine/permissions/rls/utils/__tests__/build-row-level-permission-record-filter.util.spec.ts b/packages/twenty-server/src/engine/permissions/rls/utils/__tests__/build-row-level-permission-record-filter.util.spec.ts
index 62e75854322..ca1a86467e2 100644
--- a/packages/twenty-server/src/engine/permissions/rls/utils/__tests__/build-row-level-permission-record-filter.util.spec.ts
+++ b/packages/twenty-server/src/engine/permissions/rls/utils/__tests__/build-row-level-permission-record-filter.util.spec.ts
@@ -340,13 +340,11 @@ describe('buildRowLevelPermissionRecordFilter', () => {
});
});
- describe('predicate whose operand is invalid for the field type', () => {
- it('should throw a meaningful error for an IS operand on a text field', () => {
- expect(() => build([TEXT_IS_ROLE_ID])).toThrow(
- /Operand IS is not supported for field name of type TEXT/,
- );
- });
+ it('should compile an IS operand on a text field to a case-sensitive exact match', () => {
+ expect(build([TEXT_IS_ROLE_ID])).toEqual({ name: { eq: 'stale-value' } });
+ });
+ describe('predicate whose operand is invalid for the field type', () => {
it('should throw a meaningful error for a contains operand on a select field', () => {
expect(() => build([SELECT_CONTAINS_ROLE_ID])).toThrow(
/Operand CONTAINS is not supported for field status of type SELECT/,
diff --git a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/skill-metadata/create-standard-flat-skill-metadata.util.ts b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/skill-metadata/create-standard-flat-skill-metadata.util.ts
index 7f77cb78230..ee6de76f231 100644
--- a/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/skill-metadata/create-standard-flat-skill-metadata.util.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/twenty-standard-application/utils/skill-metadata/create-standard-flat-skill-metadata.util.ts
@@ -1382,7 +1382,8 @@ Example: { "objectNameSingular": "opportunity", "type": "KANBAN", "name": "Pipel
| Field Type | Available Operators |
|---|---|
-| TEXT, EMAILS, FULL_NAME, ADDRESS, LINKS, PHONES | CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY |
+| TEXT | CONTAINS, DOES_NOT_CONTAIN, IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY |
+| EMAILS, FULL_NAME, ADDRESS, LINKS, PHONES | CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY |
| NUMBER, NUMERIC | IS, IS_NOT, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY |
| CURRENCY | GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY |
| DATE, DATE_TIME | IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY |
diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/utils/__tests__/get-incompatible-view-filter-operand-error.util.spec.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/utils/__tests__/get-incompatible-view-filter-operand-error.util.spec.ts
index fab20cc96b5..99f35bcde2b 100644
--- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/utils/__tests__/get-incompatible-view-filter-operand-error.util.spec.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-builder/validators/utils/__tests__/get-incompatible-view-filter-operand-error.util.spec.ts
@@ -15,6 +15,20 @@ describe('getIncompatibleViewFilterOperandError', () => {
).toBeUndefined();
});
+ it.each([ViewFilterOperand.IS, ViewFilterOperand.IS_NOT])(
+ 'should return undefined when %s is used on a TEXT field',
+ (operand) => {
+ expect(
+ getIncompatibleViewFilterOperandError({
+ operand,
+ fieldType: FieldMetadataType.TEXT,
+ subFieldName: null,
+ relationTargetFieldType: undefined,
+ }),
+ ).toBeUndefined();
+ },
+ );
+
it('should return an error when the operand is not supported by the field type', () => {
const error = getIncompatibleViewFilterOperandError({
operand: ViewFilterOperand.IS_IN_PAST,
diff --git a/packages/twenty-server/src/modules/dashboard/tools/schemas/widget.schema.ts b/packages/twenty-server/src/modules/dashboard/tools/schemas/widget.schema.ts
index a2e454309b7..6a2677e5ebc 100644
--- a/packages/twenty-server/src/modules/dashboard/tools/schemas/widget.schema.ts
+++ b/packages/twenty-server/src/modules/dashboard/tools/schemas/widget.schema.ts
@@ -108,7 +108,7 @@ const chartRecordFilterSchema = z.object({
operand: z
.enum(FILTER_OPERAND_OPTIONS)
.describe(
- 'Filter operator. Valid operators per field type — TEXT/EMAILS/FULL_NAME/ARRAY/PHONES: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. NUMBER/CURRENCY/RATING: GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. DATE/DATE_TIME: IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY. SELECT: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. MULTI_SELECT: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. RELATION: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. BOOLEAN: IS.',
+ 'Filter operator. Valid operators per field type — TEXT: CONTAINS, DOES_NOT_CONTAIN, IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. EMAILS/FULL_NAME/ARRAY/PHONES: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. NUMBER/CURRENCY/RATING: GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. DATE/DATE_TIME: IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY. SELECT: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. MULTI_SELECT: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. RELATION: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. BOOLEAN: IS.',
),
value: z
.string()
diff --git a/packages/twenty-server/test/integration/ai/suites/__snapshots__/mcp-view-tools.integration-spec.ts.snap b/packages/twenty-server/test/integration/ai/suites/__snapshots__/mcp-view-tools.integration-spec.ts.snap
index 6b10c0985e9..dbefe7972e1 100644
--- a/packages/twenty-server/test/integration/ai/suites/__snapshots__/mcp-view-tools.integration-spec.ts.snap
+++ b/packages/twenty-server/test/integration/ai/suites/__snapshots__/mcp-view-tools.integration-spec.ts.snap
@@ -724,7 +724,7 @@ VIEW TYPES: TABLE (default), LIST, KANBAN (requires mainGroupByFieldName, a SELE
"type": "string",
},
"operand": {
- "description": "Filter operator. Valid operators per field type — TEXT/EMAILS/FULL_NAME: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. NUMBER/NUMERIC: IS, IS_NOT, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. CURRENCY: GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. DATE/DATE_TIME: IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY. SELECT: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. MULTI_SELECT/ARRAY: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. RELATION: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. BOOLEAN: IS.",
+ "description": "Filter operator. Valid operators per field type — TEXT: CONTAINS, DOES_NOT_CONTAIN, IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. EMAILS/FULL_NAME: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. NUMBER/NUMERIC: IS, IS_NOT, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. CURRENCY: GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. DATE/DATE_TIME: IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY. SELECT: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. MULTI_SELECT/ARRAY: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. RELATION: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. BOOLEAN: IS.",
"enum": [
"IS",
"IS_NOT_NULL",
@@ -806,7 +806,7 @@ VIEW TYPES: TABLE (default), LIST, KANBAN (requires mainGroupByFieldName, a SELE
"type": "string",
},
"operand": {
- "description": "Filter operator. Valid operators per field type — TEXT/EMAILS/FULL_NAME: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. NUMBER/NUMERIC: IS, IS_NOT, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. CURRENCY: GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. DATE/DATE_TIME: IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY. SELECT: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. MULTI_SELECT/ARRAY: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. RELATION: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. BOOLEAN: IS.",
+ "description": "Filter operator. Valid operators per field type — TEXT: CONTAINS, DOES_NOT_CONTAIN, IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. EMAILS/FULL_NAME: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. NUMBER/NUMERIC: IS, IS_NOT, GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. CURRENCY: GREATER_THAN_OR_EQUAL, LESS_THAN_OR_EQUAL, IS_EMPTY, IS_NOT_EMPTY. DATE/DATE_TIME: IS, IS_RELATIVE, IS_IN_PAST, IS_IN_FUTURE, IS_TODAY, IS_BEFORE, IS_AFTER, IS_EMPTY, IS_NOT_EMPTY. SELECT: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. MULTI_SELECT/ARRAY: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY. RELATION: IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY. BOOLEAN: IS.",
"enum": [
"IS",
"IS_NOT_NULL",
diff --git a/packages/twenty-server/test/integration/graphql/suites/view/__snapshots__/view-filter-resolver.integration-spec.ts.snap b/packages/twenty-server/test/integration/graphql/suites/view/__snapshots__/view-filter-resolver.integration-spec.ts.snap
index 9c9d85b8186..cf7c431c435 100644
--- a/packages/twenty-server/test/integration/graphql/suites/view/__snapshots__/view-filter-resolver.integration-spec.ts.snap
+++ b/packages/twenty-server/test/integration/graphql/suites/view/__snapshots__/view-filter-resolver.integration-spec.ts.snap
@@ -10,7 +10,7 @@ exports[`View Filter Resolver createViewFilter should reject a view filter with
"errors": [
{
"code": "INVALID_VIEW_FILTER_DATA",
- "message": "Operand "IS" is not supported on field type "TEXT". Supported operands: CONTAINS, DOES_NOT_CONTAIN, IS_EMPTY, IS_NOT_EMPTY.",
+ "message": "Operand "GREATER_THAN_OR_EQUAL" is not supported on field type "TEXT". Supported operands: CONTAINS, DOES_NOT_CONTAIN, IS, IS_NOT, IS_EMPTY, IS_NOT_EMPTY.",
"userFriendlyMessage": "Filter operand is not supported for this field type",
},
],
diff --git a/packages/twenty-server/test/integration/graphql/suites/view/view-filter-resolver.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/view/view-filter-resolver.integration-spec.ts
index 9c53d0ba53d..e3d07775b4d 100644
--- a/packages/twenty-server/test/integration/graphql/suites/view/view-filter-resolver.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/view/view-filter-resolver.integration-spec.ts
@@ -191,7 +191,7 @@ describe('View Filter Resolver', () => {
input: {
fieldMetadataId: testFieldMetadataId,
viewId: testViewId,
- operand: ViewFilterOperand.IS,
+ operand: ViewFilterOperand.GREATER_THAN_OR_EQUAL,
value: 'test',
},
expectToFail: true,
diff --git a/packages/twenty-server/test/integration/metadata/suites/row-level-permission-predicate/__snapshots__/failing-row-level-permission-predicate-upsert.integration-spec.ts.snap b/packages/twenty-server/test/integration/metadata/suites/row-level-permission-predicate/__snapshots__/failing-row-level-permission-predicate-upsert.integration-spec.ts.snap
index 149db036843..0d6977c116c 100644
--- a/packages/twenty-server/test/integration/metadata/suites/row-level-permission-predicate/__snapshots__/failing-row-level-permission-predicate-upsert.integration-spec.ts.snap
+++ b/packages/twenty-server/test/integration/metadata/suites/row-level-permission-predicate/__snapshots__/failing-row-level-permission-predicate-upsert.integration-spec.ts.snap
@@ -223,7 +223,7 @@ exports[`Row Level Permission Predicate upsert should fail when the operand is n
"errors": [
{
"code": "INVALID_ROW_LEVEL_PERMISSION_PREDICATE_DATA",
- "message": "Operand IS is not supported for field type TEXT",
+ "message": "Operand GREATER_THAN_OR_EQUAL is not supported for field type TEXT",
"userFriendlyMessage": "This operand is not supported for this field",
},
],
diff --git a/packages/twenty-server/test/integration/metadata/suites/row-level-permission-predicate/failing-row-level-permission-predicate-upsert.integration-spec.ts b/packages/twenty-server/test/integration/metadata/suites/row-level-permission-predicate/failing-row-level-permission-predicate-upsert.integration-spec.ts
index a53cf963793..ad09d8ff277 100644
--- a/packages/twenty-server/test/integration/metadata/suites/row-level-permission-predicate/failing-row-level-permission-predicate-upsert.integration-spec.ts
+++ b/packages/twenty-server/test/integration/metadata/suites/row-level-permission-predicate/failing-row-level-permission-predicate-upsert.integration-spec.ts
@@ -167,7 +167,7 @@ const failingRowLevelPermissionPredicateUpsertTestCases: EachTestingContext<Test
predicates: [
{
fieldMetadataId: testSetup.companyNameFieldMetadataId,
- operand: RowLevelPermissionPredicateOperand.IS,
+ operand: RowLevelPermissionPredicateOperand.GREATER_THAN_OR_EQUAL,
value: 'Apple',
},
],
diff --git a/packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterIntoGqlOperationFilter.test.ts b/packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterIntoGqlOperationFilter.test.ts
index 77dfb3f1d0a..73da3f5065a 100644
--- a/packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterIntoGqlOperationFilter.test.ts
+++ b/packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterIntoGqlOperationFilter.test.ts
@@ -236,6 +236,28 @@ describe('turnRecordFilterIntoRecordGqlOperationFilter', () => {
expect(result).toEqual({ not: { name: { ilike: '%test%' } } });
});
+
+ it('should handle IS operand as case-sensitive exact match', () => {
+ const result = turnRecordFilterIntoRecordGqlOperationFilter({
+ filterValueDependencies,
+ recordFilter: makeFilter('f-text', RecordFilterOperand.IS, 'test'),
+ fieldMetadataItemById,
+ });
+
+ expect(result).toEqual({ name: { eq: 'test' } });
+ });
+
+ it('should handle IS_NOT operand and include NULL rows', () => {
+ const result = turnRecordFilterIntoRecordGqlOperationFilter({
+ filterValueDependencies,
+ recordFilter: makeFilter('f-text', RecordFilterOperand.IS_NOT, 'test'),
+ fieldMetadataItemById,
+ });
+
+ expect(result).toEqual({
+ or: [{ name: { neq: 'test' } }, { name: { is: 'NULL' } }],
+ });
+ });
});
describe('NUMBER filter', () => {
diff --git a/packages/twenty-shared/src/utils/filter/turnRecordFilterIntoGqlOperationFilter.ts b/packages/twenty-shared/src/utils/filter/turnRecordFilterIntoGqlOperationFilter.ts
index 7ef366d4066..a74dd326de2 100644
--- a/packages/twenty-shared/src/utils/filter/turnRecordFilterIntoGqlOperationFilter.ts
+++ b/packages/twenty-shared/src/utils/filter/turnRecordFilterIntoGqlOperationFilter.ts
@@ -284,6 +284,25 @@ const buildDirectFieldGqlOperationFilter = ({
} as StringFilter,
},
};
+ case RecordFilterOperand.IS:
+ return {
+ [fieldMetadataItem.name]: {
+ eq: recordFilter.value,
+ } as StringFilter,
+ };
+ case RecordFilterOperand.IS_NOT:
+ return {
+ or: [
+ {
+ [fieldMetadataItem.name]: {
+ neq: recordFilter.value,
+ } as StringFilter,
+ },
+ {
+ [fieldMetadataItem.name]: { is: 'NULL' } as StringFilter,
+ },
+ ],
+ };
default:
throw new CustomError(
`Unknown operand ${recordFilter.operand} for ${filterType} filter`,
diff --git a/packages/twenty-shared/src/utils/filter/utils/__tests__/getFilterOperandsForFilterableFieldType.test.ts b/packages/twenty-shared/src/utils/filter/utils/__tests__/getFilterOperandsForFilterableFieldType.test.ts
index 21dd0ad8b7c..771832e6af3 100644
--- a/packages/twenty-shared/src/utils/filter/utils/__tests__/getFilterOperandsForFilterableFieldType.test.ts
+++ b/packages/twenty-shared/src/utils/filter/utils/__tests__/getFilterOperandsForFilterableFieldType.test.ts
@@ -7,6 +7,18 @@ describe('getFilterOperandsForFilterableFieldType', () => {
ViewFilterOperand.IS_NOT_EMPTY,
];
+ it('should return text operands including case-sensitive equality', () => {
+ expect(
+ getFilterOperandsForFilterableFieldType({ filterType: 'TEXT' }),
+ ).toEqual([
+ ViewFilterOperand.CONTAINS,
+ ViewFilterOperand.DOES_NOT_CONTAIN,
+ ViewFilterOperand.IS,
+ ViewFilterOperand.IS_NOT,
+ ...emptyOperands,
+ ]);
+ });
+
it('should return select operands', () => {
expect(
getFilterOperandsForFilterableFieldType({ filterType: 'SELECT' }),
diff --git a/packages/twenty-shared/src/utils/filter/utils/__tests__/getFilterValueSchema.test.ts b/packages/twenty-shared/src/utils/filter/utils/__tests__/getFilterValueSchema.test.ts
index 4bd2fc679e7..c02c1739bc2 100644
--- a/packages/twenty-shared/src/utils/filter/utils/__tests__/getFilterValueSchema.test.ts
+++ b/packages/twenty-shared/src/utils/filter/utils/__tests__/getFilterValueSchema.test.ts
@@ -121,6 +121,19 @@ describe('getFilterValueSchema', () => {
});
});
+ describe('text', () => {
+ it.each([ViewFilterOperand.IS, ViewFilterOperand.IS_NOT] as const)(
+ 'should accept a non empty string on TEXT %s',
+ (operand) => {
+ expectAccepted({ filterType: 'TEXT', operand }, 'Acme');
+ },
+ );
+
+ it('should reject an empty string on TEXT IS', () => {
+ expectRejected({ filterType: 'TEXT', operand: ViewFilterOperand.IS }, '');
+ });
+ });
+
describe('numbers', () => {
it.each(['NUMBER', 'RATING', 'CURRENCY'] as const)(
'should accept a numeric string on %s',
diff --git a/packages/twenty-shared/src/utils/filter/utils/filterOperandsMap.ts b/packages/twenty-shared/src/utils/filter/utils/filterOperandsMap.ts
index 6368a93bda2..f10f8e8fb76 100644
--- a/packages/twenty-shared/src/utils/filter/utils/filterOperandsMap.ts
+++ b/packages/twenty-shared/src/utils/filter/utils/filterOperandsMap.ts
@@ -21,6 +21,8 @@ export const FILTER_OPERANDS_MAP = {
TEXT: [
ViewFilterOperand.CONTAINS,
ViewFilterOperand.DOES_NOT_CONTAIN,
+ ViewFilterOperand.IS,
+ ViewFilterOperand.IS_NOT,
...emptyOperands,
],
EMAILS: [
diff --git a/packages/twenty-shared/src/utils/filter/utils/validation-schemas/filterValueSchemasMap.ts b/packages/twenty-shared/src/utils/filter/utils/validation-schemas/filterValueSchemasMap.ts
index 92b61e9a997..0b7f4885806 100644
--- a/packages/twenty-shared/src/utils/filter/utils/validation-schemas/filterValueSchemasMap.ts
+++ b/packages/twenty-shared/src/utils/filter/utils/validation-schemas/filterValueSchemasMap.ts
@@ -68,6 +68,12 @@ const containsOperandsSchemas = {
[ViewFilterOperand.DOES_NOT_CONTAIN]: nonEmptyStringFilterValueSchema,
};
+const textOperandsSchemas = {
+ ...containsOperandsSchemas,
+ [ViewFilterOperand.IS]: nonEmptyStringFilterValueSchema,
+ [ViewFilterOperand.IS_NOT]: nonEmptyStringFilterValueSchema,
+};
+
const numericOperandsSchemas = {
[ViewFilterOperand.IS]: numericFilterValueSchema,
[ViewFilterOperand.IS_NOT]: numericFilterValueSchema,
@@ -76,7 +82,7 @@ const numericOperandsSchemas = {
};
export const FILTER_VALUE_SCHEMAS_MAP = {
- TEXT: containsOperandsSchemas,
+ TEXT: textOperandsSchemas,
EMAILS: containsOperandsSchemas,
FULL_NAME: containsOperandsSchemas,
ADDRESS: containsOperandsSchemas,