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>
This commit is contained in:
Joseph Chiang
2025-06-16 18:02:53 +10:00
committed by GitHub
parent 43bc55efcd
commit 9e49e87646
2 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ export const Notes = ({
title="All" title="All"
notes={notes} notes={notes}
button={ button={
!hasObjectUpdatePermissions && ( hasObjectUpdatePermissions && (
<Button <Button
Icon={IconPlus} Icon={IconPlus}
size="small" size="small"

View File

@ -81,7 +81,7 @@ export const SingleRecordPickerMenuItemsWithSearch = ({
<> <>
{layoutDirection === 'search-bar-on-bottom' && ( {layoutDirection === 'search-bar-on-bottom' && (
<> <>
{isDefined(onCreate) && !hasObjectUpdatePermissions && ( {isDefined(onCreate) && hasObjectUpdatePermissions && (
<DropdownMenuItemsContainer scrollable={false}> <DropdownMenuItemsContainer scrollable={false}>
{createNewButton} {createNewButton}
</DropdownMenuItemsContainer> </DropdownMenuItemsContainer>
@ -125,7 +125,7 @@ export const SingleRecordPickerMenuItemsWithSearch = ({
{records.recordsToSelect.length > 0 && isDefined(onCreate) && ( {records.recordsToSelect.length > 0 && isDefined(onCreate) && (
<DropdownMenuSeparator /> <DropdownMenuSeparator />
)} )}
{isDefined(onCreate) && !hasObjectUpdatePermissions && ( {isDefined(onCreate) && hasObjectUpdatePermissions && (
<DropdownMenuItemsContainer scrollable={false}> <DropdownMenuItemsContainer scrollable={false}>
{createNewButton} {createNewButton}
</DropdownMenuItemsContainer> </DropdownMenuItemsContainer>