post replacements: allow replacing post with identical file.

This commit is contained in:
evazion
2017-07-24 22:19:51 -05:00
parent 9893dc1734
commit 11ef460db0
3 changed files with 37 additions and 12 deletions

View File

@@ -19,7 +19,14 @@ class PostReplacement < ApplicationRecord
def process!
transaction do
upload = Upload.create!(file: replacement_file, source: replacement_url, rating: post.rating, tag_string: self.tags)
upload = Upload.create!(
file: replacement_file,
source: replacement_url,
rating: post.rating,
tag_string: self.tags,
replaced_post: post,
)
upload.process_upload
upload.update(status: "completed", post_id: post.id)