ニコタグ連携バグ修正 (#294) (#316)

#294

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #316
This commit was merged in pull request #316.
This commit is contained in:
2026-04-19 16:44:20 +09:00
parent 48f823a7c8
commit 5c7580d571
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -98,7 +98,9 @@ class Tag < ApplicationRecord
@niconico ||= find_or_create_by_tag_name!('ニコニコ', category: :meta)
end
def self.normalise_tags tag_names, with_tagme: true, deny_nico: true
def self.normalise_tags tag_names, with_tagme: true,
with_no_deerjikist: true,
deny_nico: true
if deny_nico && tag_names.any? { |n| n.downcase.start_with?('nico:') }
raise NicoTagNormalisationError
end
@@ -112,7 +114,7 @@ class Tag < ApplicationRecord
end
tags << Tag.tagme if with_tagme && tags.size < 10 && tags.none?(Tag.tagme)
tags << Tag.no_deerjikist if tags.all? { |t| !(t.deerjikist?) }
tags << Tag.no_deerjikist if with_no_deerjikist && tags.all? { |t| !(t.deerjikist?) }
tags.uniq(&:id)
end