Skip to content

The open alternative to Salesforce, designed for AI.

fix: hide add-select-option prompt for users without data model permission (#23410)

Thomas Trompette38e9d231bcd9
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiSelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiSelectFieldInput.tsx
index c9aefa38fa0..2ebd83940ad 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiSelectFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/MultiSelectFieldInput.tsx
@@ -41,13 +41,6 @@ export const MultiSelectFieldInput = () => {
onSubmit?.({ newValue: draftValue });
};
- const handleAddSelectOption = (optionName: string) => {
- if (!canAddSelectOption) {
- return;
- }
- addSelectOption(optionName);
- };
-
return (
<MultiSelectInput
selectableListComponentInstanceId={
@@ -58,7 +51,7 @@ export const MultiSelectFieldInput = () => {
onCancel={handleCancel}
onOptionSelected={handleOptionSelected}
values={draftValue}
- onAddSelectOption={handleAddSelectOption}
+ onAddSelectOption={canAddSelectOption ? addSelectOption : undefined}
/>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/SelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/SelectFieldInput.tsx
index 8d512599d1f..1571a8a104e 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/SelectFieldInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/SelectFieldInput.tsx
@@ -55,13 +55,6 @@ export const SelectFieldInput = () => {
onCancel?.();
};
- const handleAddSelectOption = (optionName: string) => {
- if (!canAddSelectOption) {
- return;
- }
- addSelectOption(optionName);
- };
-
const handleSubmit = (option: SelectOption) => {
onSubmit?.({ newValue: option.value });
@@ -110,7 +103,7 @@ export const SelectFieldInput = () => {
: undefined
}
clearLabel={fieldDefinition.label}
- onAddSelectOption={handleAddSelectOption}
+ onAddSelectOption={canAddSelectOption ? addSelectOption : undefined}
/>
);
};