From 9f10bc84674a17b776cb9c5ce30730200cb70a5a Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sun, 7 Sep 2025 19:21:33 +0900 Subject: [PATCH] =?UTF-8?q?#106=20=E3=83=8B=E3=82=B8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E6=83=85=E5=A0=B1=E3=81=AA=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/models/tag.rb | 7 +++++++ backend/lib/tasks/sync_nico.rake | 1 + 2 files changed, 8 insertions(+) diff --git a/backend/app/models/tag.rb b/backend/app/models/tag.rb index 137afff..69c6c46 100644 --- a/backend/app/models/tag.rb +++ b/backend/app/models/tag.rb @@ -46,6 +46,12 @@ class Tag < ApplicationRecord end end + def self.no_deerjikist + @no_deerjikist ||= Tag.find_or_initialize_by(name: 'ニジラー情報なし') do |tag| + tag.category = 'meta' + end + end + def self.normalise_tags tag_names, with_tagme: true tags = tag_names.map do |name| pf, cat = CATEGORY_PREFIXES.find { |p, _| name.start_with?(p) } || ['', nil] @@ -58,6 +64,7 @@ class Tag < ApplicationRecord end end tags << Tag.tagme if with_tagme && tags.size < 20 && tags.none?(Tag.tagme) + tags << Tag.no_deerjikist if tags.all? { |t| t.category != 'deerjika' } tags.uniq end diff --git a/backend/lib/tasks/sync_nico.rake b/backend/lib/tasks/sync_nico.rake index a8601c5..026e8f8 100644 --- a/backend/lib/tasks/sync_nico.rake +++ b/backend/lib/tasks/sync_nico.rake @@ -53,6 +53,7 @@ namespace :nico do end tags_to_add << Tag.tagme if post.tags.size < 20 tags_to_add << Tag.bot + tags_to_add << Tag.no_deerjikist if post.tags.all? { |t| t.category != 'deerjikist' } post.tags = (post.tags + tags_to_add).uniq end end