Skip to content

Support Full Name as Record Text Identifier #11610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

b9aurav
Copy link
Contributor

@b9aurav b9aurav commented Apr 17, 2025

closes #11296

recording.webm

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.

PR Summary

This PR adds support for using full name fields as record text identifiers, allowing them to be clickable and selectable in the settings form.

  • Added FieldMetadataType.FULL_NAME to LABEL_IDENTIFIER_FIELD_METADATA_TYPES array in /packages/twenty-front/src/modules/object-metadata/constants/LabelIdentifierFieldMetadataTypes.ts
  • Removed 'fullName' from reserved keywords in /packages/twenty-server/src/engine/metadata-modules/utils/validate-metadata-name-is-not-reserved-keyword.ts
  • Enhanced RecordChip component in /packages/twenty-front/src/modules/object-record/components/RecordChip.tsx to handle full name concatenation
  • Modified ChipFieldDisplay and useChipFieldDisplay to properly handle full name fields as identifiers
  • Updated SettingsDataModelObjectIdentifiersForm to keep identifier fields clickable even with single field

💡 (5/5) You can turn off certain types of comments like style here!

6 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

let name = recordChipData.name;

if (field?.type === FieldMetadataType.FULL_NAME) {
name = `${record[field.name]?.firstName || ''} ${record[field.name]?.lastName || ''}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider adding .trim() to remove extra space when either firstName or lastName is empty

Suggested change
name = `${record[field.name]?.firstName || ''} ${record[field.name]?.lastName || ''}`;
name = `${record[field.name]?.firstName || ''} ${record[field.name]?.lastName || ''}`.trim();

Comment on lines 49 to 50
'currencies',
'fullName',
'fullNames',
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider whether 'fullNames' should also be removed for consistency since 'fullName' is now allowed

@@ -35,6 +37,7 @@ export const RecordChip = ({
size,
forceDisableClick = false,
isLabelHidden = false,
field,
Copy link
Member

Choose a reason for hiding this comment

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

we should not pass the field here, and modify useRecordChipData instead!

@@ -70,12 +73,18 @@ export const RecordChip = ({
})
: undefined;

let name = recordChipData.name;

if (field?.type === FieldMetadataType.FULL_NAME) {
Copy link
Member

Choose a reason for hiding this comment

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

see my comment above: this should be handled in useRecordChipData

@@ -47,7 +47,6 @@ const reservedKeywords = [
'links',
'currency',
'currencies',
'fullName',
Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without removing it, Its not allowing to create field named 'Full Name' (As I created in demo clip above). It throws error: The name "fullName" is not available

fullWidth
dropdownId={`${fieldName}-select`}
emptyOption={emptyOption}
options={options}
value={value}
withSearchInput={label === t`Record label`}
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In Issue, required change is only in 'Record Label' dropdown, Not in 'Record Image' dropdown.

@@ -124,12 +128,23 @@ export const SettingsDataModelObjectIdentifiersForm = ({
render={({ field: { onChange, value } }) => (
<Select
label={label}
disabled={!objectMetadataItem.isCustom || !options.length}
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this change either

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In issue, there's mentioned in Desired Behavior section: Implement this design when only one field is available as text identifier. (Keep the field clickable, do not disable it)

@@ -22,6 +23,10 @@ export const ChipFieldDisplay = () => {
size={ChipSize.Small}
to={labelIdentifierLink}
isLabelHidden={isLabelIdentifierCompact}
field={{
Copy link
Member

Choose a reason for hiding this comment

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

see comment above

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

Hi @b9aurav, thanks for the PR
I have left comments :)

@b9aurav
Copy link
Contributor Author

b9aurav commented Apr 17, 2025

@charlesBochet Thanks for your comments, I'll take a look at requested changes.

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.

Support Full Name as Record Text Identifier
2 participants