Skip to content
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

The "Edit Raw JSON" UI does not respect "Attachment required" #3128

Closed
nordzilla opened this issue Jan 17, 2024 · 3 comments · Fixed by #3130
Closed

The "Edit Raw JSON" UI does not respect "Attachment required" #3128

nordzilla opened this issue Jan 17, 2024 · 3 comments · Fixed by #3130
Assignees
Labels

Comments

@nordzilla
Copy link

Defect Description

For a collection, it is possible to make attachments required for all records:

"attachment": {
  "enabled": true,
  "required": true
},

This setting is respected in the "Edit form" UI of the admin dashboard, see the text in the image below that says "Please select a file." when the update-record button is clicked.
image

However, moving to the "Edit raw JSON" UI enables you to click the update-record button with no error pop-up. This effectively updates the record and removes the attachment, even though attachments are required for the collection, leaving things in an invalid state.


Steps to reproduce

  1. Create a collection with attachments required.
  2. Create a record with a valid attachment.
  3. Navigate to the edit-record page for that record.
  4. Click the update-record button on the "Edit form" UI and observe the error pop-up.
  5. Navigate to the "Edit raw JSON" UI and click the update-record button.
Expected Outcome

An error pop-up saying "Please select a file." should appear, just like the "Edit form" UI.

Actual Outcome

The record is updated with no attachment, effectively removing the attachment, even though attachments are required.

@alexcottner
Copy link
Contributor

I'd like to propose a slightly different solution. If attachments are required and you're updating a record, if you don't include a new attachment it should keep the existing one. Does that sound reasonable or does it make more sense to always require a new attachment?

@nordzilla
Copy link
Author

I'd like to propose a slightly different solution. If attachments are required and you're updating a record, if you don't include a new attachment it should keep the existing one. Does that sound reasonable or does it make more sense to always require a new attachment?

Definitely! I think that would be ideal behavior.

Thank you!

@leplatrem
Copy link
Contributor

If attachments are required and you're updating a record, if you don't include a new attachment it should keep the existing one.

That is (or was at least) the behaviour when using forms, so it would be consistent with this fix

@leplatrem leplatrem added the bug label Jan 18, 2024
@alexcottner alexcottner self-assigned this Jan 18, 2024
alexcottner added a commit that referenced this issue Jan 23, 2024
…hments (#3130)

Fixes #3128 - record update functionality no longer requires a new attachment when altering a record with an existing attachment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants