このコミットが含まれているのは:
2026-10-18 01:39:03 +09:00
コミット eda81cfa89
30個のファイルの変更、965行の追加、473行の削除
+12 -5
ファイルの表示
@@ -80,6 +80,7 @@ class PostVersionsController < ApplicationController
prev: row.attributes['prev_thumbnail_base'] },
video_ms: { current: row.video_ms, prev: row.attributes['prev_video_ms'] },
tags: build_version_tags(cur_tags, prev_tags),
parent_post_ids: row.parent_post_ids,
original_created_from: {
current: row.original_created_from&.iso8601,
prev: row.attributes['prev_original_created_from']&.iso8601 },
@@ -121,10 +122,14 @@ class PostVersionsController < ApplicationController
name = tag_names[snapshot['tag_id']] || snapshot.fetch('name')
[tag_category_order(snapshot['category']),
{ identity: [:tag, snapshot['tag_id'], sections],
name: Post.tag_snapshot_literal(snapshot.merge('name' => name)) }]
name: Post.tag_snapshot_literal(snapshot.merge('name' => name)),
restore_name: tag_names[snapshot['tag_id']] &&
Post.tag_snapshot_literal(snapshot.merge('name' => name)),
external: false }]
elsif external_tag_names[snapshot['external_tag_id']]
[6, { identity: [:external_tag, snapshot['external_tag_id']],
name: external_tag_names[snapshot['external_tag_id']] }]
name: external_tag_names[snapshot['external_tag_id']],
restore_name: nil, external: true }]
end
}
.sort_by { |order, tag| [order, tag[:name].downcase] }
@@ -136,8 +141,8 @@ class PostVersionsController < ApplicationController
end
def build_version_tags cur_tags, prev_tags
current = cur_tags.to_h { [_1[:identity], _1[:name]] }
previous = prev_tags.to_h { [_1[:identity], _1[:name]] }
current = cur_tags.index_by { _1[:identity] }
previous = prev_tags.index_by { _1[:identity] }
(current.keys | previous.keys).map do |identity|
type =
@@ -149,7 +154,9 @@ class PostVersionsController < ApplicationController
'removed'
end
{ name: current[identity] || previous[identity], type: }
entry = current[identity] || previous[identity]
{ name: entry[:name], restore_name: entry[:restore_name],
external: entry[:external], type: }
end
end
end