posts: autotag video instead of webm/mp4.

Automatically add the `video` tag instead of the `webm` or `mp4` tags.
This commit is contained in:
evazion
2020-07-13 17:59:52 -05:00
parent 1e2e99a941
commit 5687c67fc3
2 changed files with 6 additions and 10 deletions

View File

@@ -499,7 +499,7 @@ class Post < ApplicationRecord
end end
def add_automatic_tags(tags) def add_automatic_tags(tags)
tags -= %w(incredibly_absurdres absurdres highres lowres huge_filesize flash webm mp4) tags -= %w(incredibly_absurdres absurdres highres lowres huge_filesize flash)
if has_dimensions? if has_dimensions?
if image_width >= 10_000 || image_height >= 10_000 if image_width >= 10_000 || image_height >= 10_000
@@ -532,12 +532,8 @@ class Post < ApplicationRecord
tags << "flash" tags << "flash"
end end
if is_webm? if is_video?
tags << "webm" tags << "video"
end
if is_mp4?
tags << "mp4"
end end
if is_ugoira? if is_ugoira?

View File

@@ -1295,18 +1295,18 @@ class PostTest < ActiveSupport::TestCase
context "with a .webm file extension" do context "with a .webm file extension" do
setup do setup do
FactoryBot.create(:tag_implication, antecedent_name: "webm", consequent_name: "animated") FactoryBot.create(:tag_implication, antecedent_name: "video", consequent_name: "animated")
@post.file_ext = "webm" @post.file_ext = "webm"
@post.tag_string = "" @post.tag_string = ""
@post.save @post.save
end end
should "have the appropriate file type tag added automatically" do should "have the appropriate file type tag added automatically" do
assert_match(/webm/, @post.tag_string) assert_match(/video/, @post.tag_string)
end end
should "apply implications after adding the file type tag" do should "apply implications after adding the file type tag" do
assert(@post.has_tag?("animated"), "expected 'webm' to imply 'animated'") assert(@post.has_tag?("animated"), "expected 'video' to imply 'animated'")
end end
end end