posts: fix has_tag? method.

Fix a bug where `Post#has_tag?` would return false for tags that
contained colons. This caused the /ai_tags page to incorrectly say
certain tags weren't present on the post.
This commit is contained in:
evazion
2022-06-26 01:07:12 -05:00
parent 97db0e6db3
commit 54e2bbd86b

View File

@@ -210,7 +210,7 @@ class Post < ApplicationRecord
end
def has_large?
return false if has_tag?("animated_gif|animated_png")
return false if has_tag?("animated_gif") || has_tag?("animated_png")
return true if is_ugoira?
is_image? && image_width.present? && image_width > Danbooru.config.large_image_width
end
@@ -603,7 +603,7 @@ class Post < ApplicationRecord
end
def has_tag?(tag)
tag_string.match?(/(?:^| )(?:#{tag})(?:$| )/)
tag_array.include?(tag)
end
def add_tag(tag)