-
- Downloads
There was an error fetching the commit references. Please try again later.
Delete remote uploads
ObjectStore uploader requires presence of associated `uploads` record when deleting the upload file (through the carrierwave's after_commit hook) because we keep info whether file is LOCAL or REMOTE in `upload` object. For this reason we can not destroy uploads as "dependent: :destroy" hook because these would be deleted too soon. Instead we rely on carrierwave's hook to destroy `uploads` in after_commit hook. But in before_destroy hook we still have to delete not-mounted uploads (which don't use carrierwave's destroy hook). This has to be done in before_Destroy instead of after_commit because `FileUpload` requires existence of model's object on destroy action. This is not ideal state of things, in a next step we should investigate how to unify model dependencies so we can use same workflow for all uploads. Related to #45425
Showing
- app/models/appearance.rb 1 addition, 2 deletionsapp/models/appearance.rb
- app/models/concerns/with_uploads.rb 37 additions, 0 deletionsapp/models/concerns/with_uploads.rb
- app/models/group.rb 1 addition, 2 deletionsapp/models/group.rb
- app/models/project.rb 1 addition, 2 deletionsapp/models/project.rb
- app/models/user.rb 1 addition, 1 deletionapp/models/user.rb
- changelogs/unreleased/jprovazn-remote-upload-destroy.yml 5 additions, 0 deletionschangelogs/unreleased/jprovazn-remote-upload-destroy.yml
- spec/models/appearance_spec.rb 9 additions, 1 deletionspec/models/appearance_spec.rb
- spec/models/group_spec.rb 9 additions, 1 deletionspec/models/group_spec.rb
- spec/models/project_spec.rb 9 additions, 1 deletionspec/models/project_spec.rb
- spec/models/user_spec.rb 9 additions, 1 deletionspec/models/user_spec.rb
- spec/support/shared_examples/models/with_uploads_shared_examples.rb 23 additions, 0 deletions...rt/shared_examples/models/with_uploads_shared_examples.rb
app/models/concerns/with_uploads.rb
0 → 100644
Please register or sign in to comment