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
|
end
|
||||||
|
|
||||||
def has_large?
|
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?
|
return true if is_ugoira?
|
||||||
is_image? && image_width.present? && image_width > Danbooru.config.large_image_width
|
is_image? && image_width.present? && image_width > Danbooru.config.large_image_width
|
||||||
end
|
end
|
||||||
@@ -603,7 +603,7 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def has_tag?(tag)
|
def has_tag?(tag)
|
||||||
tag_string.match?(/(?:^| )(?:#{tag})(?:$| )/)
|
tag_array.include?(tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_tag(tag)
|
def add_tag(tag)
|
||||||
|
|||||||
Reference in New Issue
Block a user