Skip to content

Conversation

@abk404
Copy link
Contributor

@abk404 abk404 commented Dec 17, 2025

Closes #16619

This PR adds support for filtering ACTOR fields by Workspace Member subfield, enabling users to filter records by who created them with a Me option.

I replicated the same UX and code structure as the Relation field filter for consistency.

Each filter selection triggers a server-side GraphQL call. But there is client-side filtering in isRecordMatchingFilter.ts which instantly filters already-loaded records while the server is fetching new results. I replicated this behaviour from how FULL_NAME and other composite fields handle filtering.

UX decision that were taken by me (Let me know if changes are needed) :

  • The filter shows comma separated selected workspace member names until 3 members are selected. After that it shows [no of selected members] workspace members.
Screenshot 2025-12-17 at 8 01 23 PM Screenshot 2025-12-17 at 8 01 33 PM Screenshot 2025-12-17 at 8 01 40 PM Screenshot 2025-12-17 at 8 01 53 PM Screenshot 2025-12-17 at 8 02 04 PM

Copilot AI review requested due to automatic review settings December 17, 2025 14:33
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 11 files

Prompt for AI agents (all 1 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownActorSelect.tsx">

<violation number="1" location="packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownActorSelect.tsx:49">
P2: Duplicate schema parsing: both `isCurrentWorkspaceMemberSelected` and `selectedRecordIds` are extracted from the same value using identical parsing logic. Combine these into a single parse call to avoid redundant processing.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

objectFilterDropdownSearchInputComponentState,
);

const { isCurrentWorkspaceMemberSelected } = jsonRelationFilterValueSchema
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Duplicate schema parsing: both isCurrentWorkspaceMemberSelected and selectedRecordIds are extracted from the same value using identical parsing logic. Combine these into a single parse call to avoid redundant processing.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownActorSelect.tsx, line 49:

<comment>Duplicate schema parsing: both `isCurrentWorkspaceMemberSelected` and `selectedRecordIds` are extracted from the same value using identical parsing logic. Combine these into a single parse call to avoid redundant processing.</comment>

<file context>
@@ -0,0 +1,185 @@
+    objectFilterDropdownSearchInputComponentState,
+  );
+
+  const { isCurrentWorkspaceMemberSelected } = jsonRelationFilterValueSchema
+    .catch({
+      isCurrentWorkspaceMemberSelected: false,
</file context>
Fix with Cubic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for filtering ACTOR fields by the Workspace Member subfield, enabling users to filter records by who created them with a "Me" option to quickly filter by the current user.

  • Added workspaceMemberId as a filterable subfield for ACTOR type fields
  • Implemented workspace member selection UI with a "Me" option for filtering by current user
  • Extended filter transformation logic to handle workspace member ID filtering with IS and IS_NOT operands

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/twenty-shared/src/types/RecordGqlOperationFilter.ts Added workspaceMemberId to ActorFilter type to support filtering by workspace member
packages/twenty-shared/src/utils/filter/turnRecordFilterIntoGqlOperationFilter.ts Implemented filter transformation logic for workspaceMemberId subfield with support for IS and IS_NOT operands
packages/twenty-front/src/modules/settings/data-model/constants/SettingsCompositeFieldTypeConfigs.ts Enabled isFilterable: true for the workspaceMemberId subfield of ACTOR fields
packages/twenty-front/src/modules/settings/data-model/constants/CompositeFieldSubFieldLabel.ts Updated label from "Workspace Member ID" to "Workspace Member" for better UX
packages/twenty-front/src/modules/object-record/record-filter/utils/isRecordMatchingFilter.ts Added client-side filter matching logic for workspace member ID
packages/twenty-front/src/modules/object-record/record-filter/utils/getRecordFilterOperands.ts Added workspace member subfield detection and appropriate operands (IS, IS_NOT, empty operands)
packages/twenty-front/src/modules/object-record/record-filter/constants/IconNameBySubField.ts Added icon mapping for workspace member subfield
packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/isFilterOnActorWorkspaceMemberSubField.ts New utility function to detect workspace member subfield filters
packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/getSubMenuOptions.ts Added "Workspace Member" option to ACTOR field submenu
packages/twenty-front/src/modules/object-record/object-filter-dropdown/components/ObjectFilterDropdownActorSelect.tsx New component implementing workspace member selection with "Me" option and multi-select capability
packages/twenty-front/src/modules/object-record/advanced-filter/components/AdvancedFilterDropdownFilterInput.tsx Integrated workspace member filter component into advanced filter dropdown

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 49 to 65
const { isCurrentWorkspaceMemberSelected } = jsonRelationFilterValueSchema
.catch({
isCurrentWorkspaceMemberSelected: false,
selectedRecordIds: arrayOfUuidOrVariableSchema.parse(
objectFilterDropdownFilterValue,
),
})
.parse(objectFilterDropdownFilterValue);

const { selectedRecordIds } = jsonRelationFilterValueSchema
.catch({
isCurrentWorkspaceMemberSelected: false,
selectedRecordIds: arrayOfUuidOrVariableSchema.parse(
objectFilterDropdownFilterValue,
),
})
.parse(objectFilterDropdownFilterValue);
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same schema is being parsed twice to extract different fields. This is inefficient and could lead to inconsistencies. Consider parsing once and destructuring both isCurrentWorkspaceMemberSelected and selectedRecordIds from the single parse result.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense. Fixed.

@abk404 abk404 force-pushed the add_workspace_member_actor_filter branch from 713b5da to c125421 Compare December 17, 2025 14:45
Comment on lines +1083 to +1141
const workspaceMemberIds = isCurrentWorkspaceMemberSelected
? [
...selectedRecordIds,
filterValueDependencies?.currentWorkspaceMemberId,
].filter(isDefined)
: selectedRecordIds;

This comment was marked as outdated.

@abk404 abk404 force-pushed the add_workspace_member_actor_filter branch from c125421 to 43a91c8 Compare December 17, 2025 14:47
@abk404
Copy link
Contributor Author

abk404 commented Dec 17, 2025

@Bonapara Can I get a review here ?

@Bonapara
Copy link
Member

The team is gonna review it very soon

@lucasbordeau
Copy link
Contributor

Hi @abk404 sorry for the review delay.

That's a very nice PR overall, great work.

I made some minor modifications while testing it properly that I've pushed.

Here are still things to handle for this new filter to work :

Add it to the graph filter part :

image

@Bonapara should we add back the created by field in workflows ?

image

@github-actions
Copy link
Contributor

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:59360

This environment will automatically shut down when the PR is closed or after 5 hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to filter by created by: Me

4 participants