From f3cd108b2e2f09d28277953cede9b28aaa23d63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=BF=E3=81=A6=E3=82=8B=E3=81=9E?= Date: Sat, 31 Jan 2026 15:00:56 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=8B=E3=82=B3=E3=83=8B=E3=82=B3=E5=90=8C?= =?UTF-8?q?=E6=9C=9F=E3=81=AB=E3=81=A6=20=E2=80=9C=E3=83=8B=E3=82=B3?= =?UTF-8?q?=E3=83=8B=E3=82=B3=E2=80=9D=20=E3=81=8A=E3=82=88=E3=81=B3=20?= =?UTF-8?q?=E2=80=9C=E5=8B=95=E7=94=BB=E2=80=9D=20=E3=82=92=E8=87=AA?= =?UTF-8?q?=E5=8B=95=E4=BB=98=E4=B8=8E=E3=81=99=E3=82=8B=E3=82=84=E3=81=85?= =?UTF-8?q?=E3=81=AB=EF=BC=88#156=EF=BC=89=20(#251)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #156 Co-authored-by: miteruzo Reviewed-on: https://git.miteruzo.com/miteruzo/btrc-hub/pulls/251 --- backend/app/models/tag.rb | 10 +++++++++- backend/lib/tasks/sync_nico.rake | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/app/models/tag.rb b/backend/app/models/tag.rb index e772e9c..c4b36e6 100644 --- a/backend/app/models/tag.rb +++ b/backend/app/models/tag.rb @@ -67,9 +67,17 @@ class Tag < ApplicationRecord @bot ||= find_or_create_by_tag_name!('bot操作', category: :meta) end + def self.video + @video ||= find_or_create_by_tag_name!('動画', category: :meta) + end + + def self.niconico + @niconico ||= find_or_create_by_tag_name!('ニコニコ', category: :meta) + end + def self.normalise_tags tag_names, with_tagme: true, deny_nico: true if deny_nico && tag_names.any? { |n| n.start_with?('nico:') } - raise NicoTagNormalisationError + raise NicoTagNormalisationError end tags = tag_names.map do |name| diff --git a/backend/lib/tasks/sync_nico.rake b/backend/lib/tasks/sync_nico.rake index 989c75e..b3596cb 100644 --- a/backend/lib/tasks/sync_nico.rake +++ b/backend/lib/tasks/sync_nico.rake @@ -91,7 +91,7 @@ namespace :nico do end post.save! post.resized_thumbnail! - sync_post_tags!(post, [Tag.tagme.id]) + sync_post_tags!(post, [Tag.tagme.id, Tag.bot.id, Tag.niconico.id, Tag.video.id]) end kept_ids = PostTag.kept.where(post_id: post.id).pluck(:tag_id).to_set