Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Fix typos in comments and specs | George Tsiolis | 2018-11-01 | 1 | -1/+1 |
| | |||||
* | Enable more frozen string in app/models/**/*.rb | gfyoung | 2018-08-07 | 1 | -0/+2 |
| | | | | Partially addresses #47424. | ||||
* | Fix an N+1 in avatar URLs | Sean McGivern | 2018-06-05 | 1 | -0/+4 |
| | | | | | | | | | | | | | | | | This is tricky: the query was being run in `ObjectStorage::Extension::RecordsUploads#retrieve_from_store!`, but we can't just add batch loading there, because the `#upload=` method there would use the result immediately, making the batch only have one item. Instead, we can pre-emptively add an item to the batch whenever an avatarable object is initialized, and then reuse that batch item in `#retrieve_from_store!`. However, this also has problems: 1. There is a lot of logic in `Avatarable#retrieve_upload_from_batch`. 2. Some of that logic constructs a 'fake' model for the batch key. This should be fine, because of ActiveRecord's override of `#==`, but it relies on that staying the same. | ||||
* | Fixed typo | Jan Provaznik | 2018-05-16 | 1 | -1/+1 |
| | |||||
* | Use find_in_batches instead of destroy_all | Jan Provaznik | 2018-05-16 | 1 | -1/+3 |
| | | | | destroy_all loads all records at once | ||||
* | Delete remote uploads | Jan Provaznik | 2018-05-16 | 1 | -0/+37 |
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 |