post replacements: add option to fix source after replacement.
Adds a "Final Source" field to the post replacement dialog. If specified, the post's source field will be changed to this value after replacement. This makes fixing the source back to the HTML page after replacement easier.
This commit is contained in:
@@ -4,7 +4,8 @@ class PostReplacement < ApplicationRecord
|
||||
belongs_to :post
|
||||
belongs_to :creator, class_name: "User"
|
||||
before_validation :initialize_fields
|
||||
attr_accessible :replacement_url
|
||||
attr_accessible :replacement_url, :final_source
|
||||
attr_accessor :final_source
|
||||
|
||||
def initialize_fields
|
||||
self.creator = CurrentUser.user
|
||||
@@ -37,7 +38,7 @@ class PostReplacement < ApplicationRecord
|
||||
post.image_width = upload.image_width
|
||||
post.image_height = upload.image_height
|
||||
post.file_size = upload.file_size
|
||||
post.source = upload.source
|
||||
post.source = final_source.presence || upload.source
|
||||
post.tag_string = upload.tag_string
|
||||
rescale_notes
|
||||
update_ugoira_frame_data(upload)
|
||||
|
||||
Reference in New Issue
Block a user