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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user