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

Fixes 616 - Adds file attachment logic to JSONRecordForm and tests #3056

Merged
merged 2 commits into from
Nov 14, 2023
Merged

Fixes 616 - Adds file attachment logic to JSONRecordForm and tests #3056

merged 2 commits into from
Nov 14, 2023

Conversation

alexcottner
Copy link
Contributor

@alexcottner alexcottner commented Nov 13, 2023

Fixes issue 616 by adding a file attachment input to the JSONRecordForm component.

image

Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

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

👌

@@ -170,6 +170,9 @@ export default function RecordForm(props: Props) {
disabled={!allowEditing}
record={JSON.stringify(recordData, null, 2)}
onSubmit={handleOnSubmit}
attachmentEnabled={attachment?.enabled}
// require an attachment on initial insert if attachments are required
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment could mention the fact that we don't want to require attachments on existing records, because we want to be able to edit the fields without having to reupload its attachment? Or is it obvious?

const attachment = jsRecord.attachment || {};
if (jsRecord.attachment) {
delete jsRecord.attachment;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: We have omit() in utils for this

@alexcottner alexcottner merged commit 6cd3d1a into Kinto:master Nov 14, 2023
6 checks passed
@alexcottner alexcottner deleted the attachment-fix branch November 14, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No attachment widget is shown if collection has no schema
2 participants