Compare commits

...

2 Commits

Author SHA1 Message Date
Guillim 777030c09d avoid nullable values (#12606)
Update the default set of system fields for custom objects, to ensure
position is not nullabel and has a default value to 0

Steps to reproduce :
create a custom object,
send a POST request with body ```{position:null}```
the record should be created

After the change, 
an error will be thrown
<img width="754" alt="Screenshot 2025-06-13 at 17 16 56"
src="https://github.com/user-attachments/assets/d40931f7-16cc-4b68-8dbb-deb0fa292be5"
/>
2025-06-16 11:32:50 +02:00
Joseph Chiang 99a1801d32 fix: correct inverted permission checks for create buttons (fix #12581) (#12614)
## Summary
This PR fixes inverted permission checks that were preventing authorized
users from seeing "Add New" and "Add note" buttons while showing them to
unauthorized users.

## Changes
- Fixed permission check in `SingleRecordPickerMenuItemsWithSearch`
component (2 locations)
- Fixed permission check in `Notes` component

## Issue
These permission checks were incorrectly using
`\!hasObjectUpdatePermissions` (NOT has permissions) when they should
have been checking `hasObjectUpdatePermissions` (has permissions).

This is similar to the issue mentioned in PR #12437.

## Test plan
- [ ] Verify that users WITH update permissions can see the "Add New"
button in record pickers
- [ ] Verify that users WITHOUT update permissions cannot see the "Add
New" button
- [ ] Verify that users WITH update permissions can see the "Add note"
button in Notes component
- [ ] Verify that users WITHOUT update permissions cannot see the "Add
note" button

🤖 Generated with Claude Code (https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-16 11:32:41 +02:00
3 changed files with 5 additions and 5 deletions
@@ -90,7 +90,7 @@ export const Notes = ({
title="All"
notes={notes}
button={
!hasObjectUpdatePermissions && (
hasObjectUpdatePermissions && (
<Button
Icon={IconPlus}
size="small"
@@ -81,7 +81,7 @@ export const SingleRecordPickerMenuItemsWithSearch = ({
<>
{layoutDirection === 'search-bar-on-bottom' && (
<>
{isDefined(onCreate) && !hasObjectUpdatePermissions && (
{isDefined(onCreate) && hasObjectUpdatePermissions && (
<DropdownMenuItemsContainer scrollable={false}>
{createNewButton}
</DropdownMenuItemsContainer>
@@ -125,7 +125,7 @@ export const SingleRecordPickerMenuItemsWithSearch = ({
{records.recordsToSelect.length > 0 && isDefined(onCreate) && (
<DropdownMenuSeparator />
)}
{isDefined(onCreate) && !hasObjectUpdatePermissions && (
{isDefined(onCreate) && hasObjectUpdatePermissions && (
<DropdownMenuItemsContainer scrollable={false}>
{createNewButton}
</DropdownMenuItemsContainer>
@@ -98,11 +98,11 @@ export const buildDefaultFieldsForCustomObject = (
label: 'Position',
icon: 'IconHierarchy2',
description: 'Position',
isNullable: true,
isNullable: false,
isActive: true,
isCustom: false,
isSystem: true,
workspaceId,
defaultValue: null,
defaultValue: 0,
},
];