From 54e2bbd86b1a2ef43ab4347175db187003d25bd9 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 26 Jun 2022 01:07:12 -0500 Subject: [PATCH] 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. --- app/models/post.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index 3f265a857..0a1c64d3d 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -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)