This commit is contained in:
2026-04-19 19:49:56 +09:00
parent 58429c5e8b
commit 2ea08ef4dd
10 changed files with 54 additions and 29 deletions
@@ -173,6 +173,8 @@ class PostsController < ApplicationController
post = Post.find(params[:id].to_i)
ApplicationRecord.transaction do
PostVersionRecorder.ensure_snapshot!(post, created_by_user: current_user)
post.update!(title:, original_created_from:, original_created_before:)
normalised_tags = Tag.normalise_tags(tag_names, with_tagme: false)
@@ -12,6 +12,8 @@ class TagChildrenController < ApplicationController
return head :bad_request if parent.nico? || child.nico?
ApplicationRecord.transaction do
TagVersioning.ensure_snapshot!(child, created_by_user: current_user)
TagImplication.find_or_create_by!(parent_tag: parent, tag: child)
TagVersionRecorder.record!(tag: child, event_type: :update, created_by_user: current_user)
end
@@ -32,6 +34,8 @@ class TagChildrenController < ApplicationController
return head :bad_request if parent.nico? || child.nico?
ApplicationRecord.transaction do
TagVersioning.ensure_snapshot!(child, created_by_user: current_user)
TagImplication.find_by(parent_tag: parent, tag: child)&.destroy!
TagVersionRecorder.record!(tag: child, event_type: :update, created_by_user: current_user)
end
@@ -224,8 +224,11 @@ class TagsController < ApplicationController
end
ApplicationRecord.transaction do
TagVersioning.ensure_snapshot!(tag, created_by_user: current_user)
tag.tag_name.update!(name:) if name.present?
tag.update!(category:) if category.present?
record_tag_version!(tag, event_type: :update, created_by_user: current_user)
end