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

4821-part1-partner-profile-support-multiple-attached-docs #5035

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danielabar
Copy link
Collaborator

Partial solution for #4821

Description

This is the first part in a series of planned improvements for the "Additional Documents" section of Partner Profile editing.

Currently, even though the field is named in the plural "Additional Documents" and is using the has_many_attached association, in practice, the partner can only ever have one document at a time. Any time they upload a new one, it removes whatever was there previously.

What this fixes is to maintain the existing document(s), when a new one is uploaded, by including a hidden signed_id field for every document that is already attached. This solution is explained in the Rails Guide on Active Storage.

Note

This is only implemented in the step-wise version of the Partner Profile edit form as the legacy "all-in-one" version is no longer in use (and should eventually be retired - future ticket).

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

For automated testing, see new system test spec/system/partners/profile_edit_system_spec.rb "preserves previously uploaded documents when adding new attachments".

For manual testing:

  • Login as an invited partner [email protected]
  • Click on "Edit Profile" from the left hand side navigation
  • Open the "Attached Documents" accordion section
  • Upload a document and Save Progress
  • Open the "Attached Documents" accordion section again and upload another document, and Save Progress
  • Open the section and this time you should see both documents listed (previously only the newest one uploaded would be preserved)
  • Optionally, you can also select multiple files at a time, they should all be saved, then if you come back to add more, originals plus anything new you added should all remain

Screenshots

image

@cielf
Copy link
Collaborator

cielf commented Feb 23, 2025

Note for technical reviewer -- being able to remove them is a (hopefully fairly quick) follow-on.

@cielf
Copy link
Collaborator

cielf commented Feb 24, 2025

I'll be trying this out on local, tonight or tomorrow, but I'd rather not put it out in the same release as #5023.

@cielf
Copy link
Collaborator

cielf commented Feb 25, 2025

Looks good to me (given that this is a first step). Over to @dorner for technical comments.

@cielf cielf requested a review from dorner February 25, 2025 18:37
Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

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

Looks good to me! We can merge after the S3 stuff goes out.

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.

3 participants