This commit is contained in:
2025-07-09 23:58:03 +09:00
parent 9be4bb1532
commit b83fc6369a
4 changed files with 46 additions and 38 deletions
+5 -13
View File
@@ -45,20 +45,12 @@ namespace :nico do
if current_tags != new_tags
post.tags.destroy(post.tags.where(name: current_tags))
new_tags.each do |name|
post.tags << Tag.find_or_initialize_by(name:, category: 'nico')
post.tags << Tag.find_or_initialize_by(name:) do |tag|
tag.category = 'nico'
end
end
if post.tags.size < 20
name = 'タグ希望'
post.tags.destroy(post.tags.find_by(name:) || [])
post.tags << Tag.find_or_initialize_by(name:) { |tag|
tag.category = 'meta'
}
end
name = 'bot操作'
post.tags.destroy(post.tags.find_by(name:) || [])
post.tags << Tag.find_or_initialize_by(name:) { |tag|
tag.category = 'meta'
}
post.tags << Tag.tagme if post.tags.size < 20 && post.tags.none?(Tag.tagme)
post.tags << Tag.bot if post.tags.none?(Tag.bot)
end
end
end