Skip to content

Conversation

@asasin235
Copy link
Contributor

@asasin235 asasin235 commented Dec 17, 2025

Summary

Adds the ability to filter records by the createdBy field's workspaceMemberId, with a special "Me" option for the current user. This allows users to quickly find records they created.

Changes

Implementation

  • SettingsCompositeFieldTypeConfigs.ts - Enabled isFilterable: true for workspaceMemberId subfield
  • CompositeFieldSubFieldLabel.ts - Changed label to "Workspace Member" for better UX
  • IconNameBySubField.ts - Added IconUser icon for the new filter option
  • ObjectFilterDropdownWorkspaceMemberSelect.tsx - New component with "Me" pinned option
  • isFilterOnActorWorkspaceMemberSubField.ts - Helper utility function
  • getSubMenuOptions.ts - Added "Workspace Member" option to ACTOR submenu
  • getRecordFilterOperands.ts - Added IS/IS_NOT operands for workspaceMemberId
  • ObjectFilterDropdownFilterInput.tsx - Renders workspace member select for ACTOR filter
  • AdvancedFilterDropdownFilterInput.tsx - Same handling for advanced filters
  • turnRecordFilterIntoGqlOperationFilter.ts - Added GQL filter generation with isCurrentWorkspaceMemberSelected support

Tests (42 test cases)

  • SettingsCompositeFieldTypeConfigs.test.ts - Config tests to ensure workspaceMemberId is filterable
  • isFilterOnActorWorkspaceMemberSubField.test.ts - Helper function tests
  • getSubMenuOptions.test.ts - Submenu options tests
  • getRecordFilterOperands.test.ts - Filter operands tests
  • turnRecordFilterIntoGqlOperationFilter.actorWorkspaceMemberId.test.ts - GQL filter generation tests

UI Flow

  1. User clicks "Created by" filter field
  2. Submenu shows: Source, Name, Workspace Member (new!)
  3. Selecting "Workspace Member" shows:
    • "Me" pinned at top
    • Search bar
    • List of workspace members
  4. Filter displays as "Created by is Me" or "Created by is [Member Name]"

Screenshots

CleanShot 2025-12-17 at 23 59 56

GraphQL Filter Output

{
  createdBy: {
    workspaceMemberId: {
      in: ["member-id-1", "current-user-id"]
    }
  }
}

How to Test

  1. Go to any record list (People, Companies, Opportunities, etc.)
  2. Click "Add filter" → "Created by"
  3. Select "Workspace Member" from submenu
  4. Select "Me" or any workspace member
  5. Verify records are filtered correctly
# Run unit tests
npx jest --config=packages/twenty-front/jest.config.mjs \
  packages/twenty-front/src/modules/settings/data-model/constants/__tests__/SettingsCompositeFieldTypeConfigs.test.ts \
  packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/isFilterOnActorWorkspaceMemberSubField.test.ts \
  packages/twenty-front/src/modules/object-record/object-filter-dropdown/utils/__tests__/getSubMenuOptions.test.ts \
  packages/twenty-front/src/modules/object-record/record-filter/utils/__tests__/getRecordFilterOperands.test.ts

npx jest --config=packages/twenty-shared/jest.config.mjs \
  packages/twenty-shared/src/utils/filter/__tests__/turnRecordFilterIntoGqlOperationFilter.actorWorkspaceMemberId.test.ts

this solves: #16619
#16619

Checklist

  • Implementation complete
  • Unit tests added (42 test cases)
  • Config test to prevent regression
  • Screenshots attached
  • Manual testing done

Copilot AI review requested due to automatic review settings December 17, 2025 18:38
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.

No issues found across 16 files

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 a "Created by: Me" filter feature for the ACTOR field's workspaceMemberId subfield, allowing users to filter records based on the workspace member who created them, with a convenient "Me" option for the current user.

  • Added filtering capability for ACTOR field's workspaceMemberId subfield
  • Implemented a new workspace member selector component with a pinned "Me" option
  • Extended GraphQL filter generation to handle workspace member filtering with IS/IS_NOT operands

Reviewed changes

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

Show a summary per file
File Description
turnRecordFilterIntoGqlOperationFilter.ts Adds GQL filter generation logic for workspaceMemberId with support for current workspace member selection
turnRecordFilterIntoGqlOperationFilter.actorWorkspaceMemberId.test.ts Comprehensive test suite (9 test cases) covering IS/IS_NOT operands, "Me" selection, and edge cases
RecordGqlOperationFilter.ts Extends ActorFilter type definition to include workspaceMemberId field
SettingsCompositeFieldTypeConfigs.test.ts Config validation tests ensuring workspaceMemberId is properly marked as filterable
SettingsCompositeFieldTypeConfigs.ts Enables filtering for workspaceMemberId subfield in ACTOR field configuration
CompositeFieldSubFieldLabel.ts Updates label from "Workspace Member ID" to "Workspace Member" for better UX
getRecordFilterOperands.ts Adds IS/IS_NOT operands for workspaceMemberId filters
getRecordFilterOperands.test.ts Test coverage (6 test cases) for new operands on ACTOR workspaceMemberId subfield
IconNameBySubField.ts Maps IconUser icon to workspaceMemberId subfield
isFilterOnActorWorkspaceMemberSubField.ts Helper utility to identify workspaceMemberId subfield filters
isFilterOnActorWorkspaceMemberSubField.test.ts Test coverage (7 test cases) for helper function
getSubMenuOptions.ts Adds "Workspace Member" option to ACTOR field submenu
getSubMenuOptions.test.ts Test coverage (10 test cases) for submenu options including new workspace member option
ObjectFilterDropdownWorkspaceMemberSelect.tsx New component implementing workspace member selection with pinned "Me" option
ObjectFilterDropdownFilterInput.tsx Integrates workspace member selector for ACTOR workspaceMemberId filters
AdvancedFilterDropdownFilterInput.tsx Adds workspace member selector support to advanced filters

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

Comment on lines +22 to +26
export const EMPTY_FILTER_VALUE: string = JSON.stringify({
isCurrentWorkspaceMemberSelected: false,
selectedRecordIds: [],
} satisfies RelationFilterValue);

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 constant EMPTY_FILTER_VALUE is exported but never used in this component. On line 186, an empty string is hardcoded instead of using this constant. Either use the constant for consistency or remove it if it's not needed.

Suggested change
export const EMPTY_FILTER_VALUE: string = JSON.stringify({
isCurrentWorkspaceMemberSelected: false,
selectedRecordIds: [],
} satisfies RelationFilterValue);

Copilot uses AI. Check for mistakes.
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.

2 participants