-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
Partner profile -- rework additional documents to be more workable #4821
Comments
Found this in the Rails Guide on Active Storage that might explain the existing observed behaviour that old docs are getting removed when more are attached later: Replacing vs Adding Attachments
|
@cielf Just fyi, this commit fixes the original observed bug that if a user uploads an attached doc during profile edit, saves, then comes back later to add more, the first one is removed. It also supports attaching multiple docs, then coming back and adding one or more later, and all are preserved. From there I can continue on the additional requirements re: selectively deleting. But just in case the bug of losing documents when uploading more is urgent, that initial commit fixes that. |
I think it would be a fine idea to put that in as an initial PR that partially resolves this issue, as it is fixing a current problem, and the rest is adding functionality. Please and thanks! |
With regards to the related issue #4472 , where if a user selects a new document for upload, and enters something invalid in one of the other fields, and them submits the form for update, then they get a 500 Internal Server Error. I have a solution on my branch that doesn't involve changing to direct uploads and new CORS config: Firstly, when the form renders with validation errors, check that the existing documents are persisted before attempting to render them. This fixes the 500 Internal Server Error that would otherwise occur from trying to render a new unpersisted document. Second, in the update action, it's possible to detect that user was trying to upload something. In this case, if a validation error occurs AND user was trying to upload an attached doc, render an additional alert telling them they'll need to select that doc again. Note that my solution fixes this for the Attached Documents section, not the IRS document (didn't want to scope creep into another ticket). If this solution is acceptable, then the developer working on the other ticket could use this solution as well. |
In an ideal world, they wouldn't have to re-upload. |
This issue is marked as stale due to no activity within 30 days. If no further activity is detected within 7 days, it will be unassigned. |
Still a work-in-progress, although working on kind of related #4472 first. |
Summary
Currently, the Additional documents only allows access to one document. We want to really allow multiple documents, and to also allow deleting documents
Why?
We need both the ability to have multiple documents and user deletion of old documents to support long term partner bank relationships.
Details
HINT: From Discussion on PR 4505
"The Partner::Profile model does in theory support multiple attached documents:
has_many_attached :documents
But when I attach a new one, there's an ActiveStorage::PurgeJob running that removes the old one."
Criteria for completion
The text was updated successfully, but these errors were encountered: