#106 ニジラー情報なし
このコミットが含まれているのは:
@@ -46,6 +46,12 @@ class Tag < ApplicationRecord
|
|||||||
end
|
end
|
||||||
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
|
def self.normalise_tags tag_names, with_tagme: true
|
||||||
tags = tag_names.map do |name|
|
tags = tag_names.map do |name|
|
||||||
pf, cat = CATEGORY_PREFIXES.find { |p, _| name.start_with?(p) } || ['', nil]
|
pf, cat = CATEGORY_PREFIXES.find { |p, _| name.start_with?(p) } || ['', nil]
|
||||||
@@ -58,6 +64,7 @@ class Tag < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
tags << Tag.tagme if with_tagme && tags.size < 20 && tags.none?(Tag.tagme)
|
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
|
tags.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ namespace :nico do
|
|||||||
end
|
end
|
||||||
tags_to_add << Tag.tagme if post.tags.size < 20
|
tags_to_add << Tag.tagme if post.tags.size < 20
|
||||||
tags_to_add << Tag.bot
|
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
|
post.tags = (post.tags + tags_to_add).uniq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
新しい課題から参照
ユーザをブロックする