-
Notifications
You must be signed in to change notification settings - Fork 5k
fix isCalendarFieldReadOnly function to check if calender field is re… #17319
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
base: main
Are you sure you want to change the base?
fix isCalendarFieldReadOnly function to check if calender field is re… #17319
Conversation
There was a problem hiding this 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 1 file
Welcome!
Hello there, congrats on your first PR! We're excited to have you contributing to this project. |
Greptile SummaryFixed calendar view drag behavior to respect UI read-only field metadata, ensuring consistency with table view behavior.
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant RecordCalendarCardDraggableContainer
participant useRecordCalendarContext
participant useIsRecordReadOnly
participant useObjectPermissionsForObject
participant Recoil as Recoil State
participant isFieldMetadataReadOnlyByPermissions
participant Draggable
User->>RecordCalendarCardDraggableContainer: Attempts to drag calendar card
RecordCalendarCardDraggableContainer->>useRecordCalendarContext: Get objectMetadataItem
useRecordCalendarContext-->>RecordCalendarCardDraggableContainer: Return objectMetadataItem
RecordCalendarCardDraggableContainer->>useIsRecordReadOnly: Check if record is read-only
useIsRecordReadOnly-->>RecordCalendarCardDraggableContainer: Return isRecordReadOnly
RecordCalendarCardDraggableContainer->>useObjectPermissionsForObject: Get object permissions
useObjectPermissionsForObject-->>RecordCalendarCardDraggableContainer: Return objectPermissions
RecordCalendarCardDraggableContainer->>Recoil: Get recordIndexCalendarFieldMetadataId
Recoil-->>RecordCalendarCardDraggableContainer: Return calendar field metadata ID
RecordCalendarCardDraggableContainer->>RecordCalendarCardDraggableContainer: Find calendarFieldMetadataItem by ID
alt calendarFieldMetadataItem exists
RecordCalendarCardDraggableContainer->>RecordCalendarCardDraggableContainer: Check isUIReadOnly
RecordCalendarCardDraggableContainer->>isFieldMetadataReadOnlyByPermissions: Check permissions
isFieldMetadataReadOnlyByPermissions-->>RecordCalendarCardDraggableContainer: Return permission-based read-only status
RecordCalendarCardDraggableContainer->>RecordCalendarCardDraggableContainer: Combine isUIReadOnly OR permission-based read-only
else calendarFieldMetadataItem is null
RecordCalendarCardDraggableContainer->>RecordCalendarCardDraggableContainer: Set isCalendarFieldReadOnly = false
end
RecordCalendarCardDraggableContainer->>RecordCalendarCardDraggableContainer: Calculate isDragDisabled = isRecordReadOnly OR isCalendarFieldReadOnly
RecordCalendarCardDraggableContainer->>Draggable: Pass isDragDisabled prop
alt isDragDisabled is true
Draggable-->>User: Dragging prevented (cursor shows not-allowed)
else isDragDisabled is false
Draggable-->>User: Dragging allowed
end
|
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:61464 This environment will automatically shut down when the PR is closed or after 5 hours. |
This PR fixes the inconsistency between Calendar and Table views when trying to edit createdAt date field.
Previously, calendar cards could be dragged even though the createdAt field are UI read-only, resulting in the confusing and inconsistent behavior compared to the Table view where the field is not editable.
The issue was caused by the drag logic checking only user permissions and not the field’s UI read-only metadata. This change updates the calendar drag logic to also check for isUIReadOnly, ensuring that records are not draggable when the selected calendar date field is read-only.