forked from e621ng/e621ng
[Replacements] Fix duration when replacing gif -> webm
This commit is contained in:
parent
2af251b387
commit
b2a733d0c4
@ -82,6 +82,7 @@ class UploadService
|
||||
post.image_width = upload.image_width
|
||||
post.image_height = upload.image_height
|
||||
post.file_size = upload.file_size
|
||||
post.duration = upload.video_duration(upload.file.path)
|
||||
post.source = "#{replacement.source}\n" + post.source
|
||||
post.tag_string = upload.tag_string
|
||||
# Reset ownership information on post.
|
||||
|
@ -146,7 +146,6 @@ class PostReplacementTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
should "update post with new image" do
|
||||
old_md5 = @post.md5
|
||||
@replacement.approve! penalize_current_uploader: true
|
||||
@ -249,6 +248,18 @@ class PostReplacementTest < ActiveSupport::TestCase
|
||||
@replacement.approve! penalize_current_uploader: false
|
||||
assert_equal ["Status must be pending or original to approve"], @replacement.errors.full_messages
|
||||
end
|
||||
|
||||
context "update the duration" do
|
||||
setup do
|
||||
@replacement = FactoryBot.create(:webm_replacement, creator: @user, creator_ip_addr: '127.0.0.1', post: @post)
|
||||
end
|
||||
|
||||
should "when the replacement is a video" do
|
||||
@replacement.approve! penalize_current_uploader: false
|
||||
@post.reload
|
||||
assert @post.duration
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Toggle:" do
|
||||
|
Loading…
Reference in New Issue
Block a user