This commit is contained in:
2026-05-01 06:03:45 +09:00
parent 674ac32817
commit bebfe02348
7 changed files with 520 additions and 99 deletions
@@ -33,8 +33,8 @@ class NicoTagsController < ApplicationController
return head :bad_request unless tag.nico?
linked_tag_names = params[:tags].to_s.split
linked_tags = Tag.normalise_tags(linked_tag_names, with_tagme: false,
with_no_deerjikist: 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.nico? }
ApplicationRecord.transaction do
+4 -4
View File
@@ -147,12 +147,12 @@ class PostsController < ApplicationController
post.reload
render json: PostRepr.base(post), status: :created
rescue Tag::NicoTagNormalisationError
head :bad_request
rescue ArgumentError => e
render json: { errors: [e.message] }, status: :unprocessable_entity
rescue ActiveRecord::RecordInvalid => e
render json: { errors: e.record.errors.full_messages }, status: :unprocessable_entity
rescue Tag::NicoTagNormalisationError
head :bad_request
end
def viewed
@@ -202,12 +202,12 @@ class PostsController < ApplicationController
json = post.as_json
json['tags'] = build_tag_tree_for(post.tags)
render json:, status: :ok
rescue Tag::NicoTagNormalisationError
head :bad_request
rescue ArgumentError => e
render json: { errors: [e.message] }, status: :unprocessable_entity
rescue ActiveRecord::RecordInvalid => e
render json: { errors: e.record.errors.full_messages }, status: :unprocessable_entity
rescue Tag::NicoTagNormalisationError
head :bad_request
end
def changes