Compare commits

..

2 Commits

Author SHA1 Message Date
みてるぞ 9ef2d8307a #294 2026-04-18 20:29:47 +09:00
みてるぞ 48f823a7c8 履歴画面変更(#308) (#315)
Merge branch 'main' into feature/308

#308

#308

#308

#308

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #315
2026-04-18 05:43:33 +09:00
2 changed files with 6 additions and 3 deletions
@@ -33,7 +33,8 @@ class NicoTagsController < ApplicationController
return head :bad_request if tag.category != 'nico' return head :bad_request if tag.category != 'nico'
linked_tag_names = params[:tags].to_s.split(' ') linked_tag_names = params[:tags].to_s.split(' ')
linked_tags = Tag.normalise_tags(linked_tag_names, with_tagme: false) linked_tags = Tag.normalise_tags(linked_tag_names, with_tagme: false,
with_no_deerjikist: false)
return head :bad_request if linked_tags.any? { |t| t.category == 'nico' } return head :bad_request if linked_tags.any? { |t| t.category == 'nico' }
tag.linked_tags = linked_tags tag.linked_tags = linked_tags
+4 -2
View File
@@ -98,7 +98,9 @@ class Tag < ApplicationRecord
@niconico ||= find_or_create_by_tag_name!('ニコニコ', category: :meta) @niconico ||= find_or_create_by_tag_name!('ニコニコ', category: :meta)
end end
def self.normalise_tags tag_names, with_tagme: true, deny_nico: true def self.normalise_tags tag_names, with_tagme: true,
with_no_deerjikist: true,
deny_nico: true
if deny_nico && tag_names.any? { |n| n.downcase.start_with?('nico:') } if deny_nico && tag_names.any? { |n| n.downcase.start_with?('nico:') }
raise NicoTagNormalisationError raise NicoTagNormalisationError
end end
@@ -112,7 +114,7 @@ class Tag < ApplicationRecord
end end
tags << Tag.tagme if with_tagme && tags.size < 10 && tags.none?(Tag.tagme) tags << Tag.tagme if with_tagme && tags.size < 10 && tags.none?(Tag.tagme)
tags << Tag.no_deerjikist if tags.all? { |t| !(t.deerjikist?) } tags << Tag.no_deerjikist if with_no_deerjikist && tags.all? { |t| !(t.deerjikist?) }
tags.uniq(&:id) tags.uniq(&:id)
end end