Skip to content

Force readonly for deletedAt field #12840

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

Merged
merged 2 commits into from
Jun 24, 2025

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Jun 24, 2025

Fixes #12839

Context

We now force readonly mode for deletedAt datepicker as permissions don't handle well this use case. The frontend should call softDelete endpoint in this case. For a user, they should select the record and click on the trash icon instead

Screenshot 2025-06-24 at 17 30 03

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

Forces readonly mode for deletedAt datepicker field to ensure proper handling of record deletion through the UI trash icon instead of direct field modification.

  • Added readonly condition in packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationRecordsListItem.tsx to prevent direct modification of deletedAt field
  • Directs users to use the trash icon for soft deleting records instead of manually setting deletedAt date
  • Implements safeguard against potential permission handling issues with deletedAt field modifications

1 file reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

Comment on lines 310 to 311
isReadOnly:
fieldMetadataItem.name === 'deletedAt' || isFieldReadOnly,
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 extracting special field names like 'deletedAt' into a constant or enum to avoid magic strings and improve maintainability

Copy link
Member

Choose a reason for hiding this comment

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

modify isFieldValueReadOnly

Copy link
Member

Choose a reason for hiding this comment

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

  • add a test

@charlesBochet charlesBochet merged commit 3cef6c9 into main Jun 24, 2025
39 checks passed
@charlesBochet charlesBochet deleted the c--force-readonly-for-deleted-at-field branch June 24, 2025 15:34
Copy link
Contributor

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:17707

This environment will automatically shut down when the PR is closed or after 5 hours.

abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 26, 2025
Fixes twentyhq#12839

## Context
We now force readonly mode for deletedAt datepicker as permissions don't
handle well this use case. The frontend should call softDelete endpoint
in this case. For a user, they should select the record and click on the
trash icon instead

<img width="467" alt="Screenshot 2025-06-24 at 17 30 03"
src="https://github.com/user-attachments/assets/0a8a0709-305b-440f-91c2-d5e3f23ca213"
/>
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.

Can delete workspace member
3 participants