From 93f494725d97e221b151bcc9311447e1bda3acd8 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sat, 31 Jan 2026 14:55:44 +0900 Subject: [PATCH] #156 --- 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 -- 2.34.1