uploads: refactor to simplify ugoira-handling and replacements:

* Make it so replacing a post doesn't generate a dummy upload as a side effect.
* Make it so you can't replace a post with itself (the post should be regenerated instead).
* Refactor uploads and replacements to save the ugoira frame data when
  the MediaAsset is created, not when the post is created. This way it's
  possible to view the ugoira before the post is created.
* Make `download_file!` in the Pixiv source strategy return a MediaFile
  with the ugoira frame data already attached to it, instead of returning it
  in the `data` field then passing it around separately in the `context`
  field of the upload.
This commit is contained in:
evazion
2021-10-18 04:54:52 -05:00
parent 85c3b4f2d1
commit bc506ed1b8
17 changed files with 76 additions and 221 deletions

View File

@@ -0,0 +1,5 @@
class ChangePostIdToNullableOnPixivUgoiraFrameData < ActiveRecord::Migration[6.1]
def change
change_column_null :pixiv_ugoira_frame_data, :post_id, true
end
end