タグ履歴 (#309) (#319)

#309

#309

#309

#309

#309

Merge remote-tracking branch 'origin/main' into feature/309

#309

Co-authored-by: miteruzo <miteruzo@naver.com>
Reviewed-on: #319
This commit was merged in pull request #319.
This commit is contained in:
2026-04-19 20:21:51 +09:00
parent 5c7580d571
commit bde7d33949
27 changed files with 923 additions and 123 deletions
+11 -4
View File
@@ -128,9 +128,11 @@ class PostsController < ApplicationController
original_created_from:, original_created_before:)
post.thumbnail.attach(thumbnail)
ActiveRecord::Base.transaction do
ApplicationRecord.transaction do
post.save!
tags = Tag.normalise_tags(tag_names)
TagVersioning.record_tag_snapshots!(tags, created_by_user: current_user)
tags = Tag.expand_parent_tags(tags)
sync_post_tags!(post, tags)
post.resized_thumbnail!
@@ -170,10 +172,15 @@ class PostsController < ApplicationController
post = Post.find(params[:id].to_i)
ActiveRecord::Base.transaction do
ApplicationRecord.transaction do
PostVersionRecorder.ensure_snapshot!(post, created_by_user: current_user)
post.update!(title:, original_created_from:, original_created_before:)
tags = post.tags.where(category: 'nico').to_a +
Tag.normalise_tags(tag_names, with_tagme: false)
normalised_tags = Tag.normalise_tags(tag_names, with_tagme: false)
TagVersioning.record_tag_snapshots!(normalised_tags, created_by_user: current_user)
tags = post.tags.nico.to_a + normalised_tags
tags = Tag.expand_parent_tags(tags)
sync_post_tags!(post, tags)
PostVersionRecorder.record!(post:, event_type: :update, created_by_user: current_user)