ファイル
btrc-hub/backend/app/representations/wiki_page_repr.rb
T
33af84d7fe AI: #450 最新系から履歴系を参照することのないやぅに変更 (#462)
Refs #450

Branch mode: `new`; base: `main`; head: `feature/450`

Implementation model: `gpt-6.1-sol` / reasoning: `high`

## Automated implementation (requires human review)
実装しました。

- `/posts` の履歴集計を廃止し、更新日時の表示・絞り込み・並び順を `posts.updated_at` に統一しました。
- 現在テーブルに対する履歴判定と、不要になった共通メソッドを削除しました。
- `_versions` を読む処理の認可は維持しています。

`git diff --check` は通過しました。指定に従い、テスト・lint・ビルド・マイグレーションは未実行です。

## Verification
- Tests/builds/migrations were not authorized and were not invoked by the controller.
- Codex was instructed not to run them; inspect its command transcript.
- The repository owner alone reviews changes. No AI review is executed.
- Do not merge before human acceptance and required checks.

---------

Co-authored-by: Codex Night Worker <codex-night@localhost>
Co-authored-by: みてるぞ <miteruzo@naver.com>
Reviewed-on: #462
Co-authored-by: テツノニジカ <969+codex-bot@noreply.localhost>
2026-11-23 03:49:46 +09:00

50 行
1.5 KiB
Ruby

# frozen_string_literal: true
module WikiPageRepr
module_function
def tag_description locale, description
tag = description.tag
{ 'id' => description.id,
'resource_type' => 'tag_description',
'tag_id' => tag.id,
'language_code' => description.language_code,
'tag_name_id' => tag.tag_name(locale.language_code)&.id,
'body' => description.body,
'created_user_id' => description.created_by_user_id,
'updated_user_id' => description.updated_by_user_id,
'created_at' => description.created_at,
'updated_at' => description.updated_at,
'discarded_at' => nil,
'version_no' => description.version_no,
'title' => tag.name(locale.language_code),
'deprecated_at' => tag.deprecated_at }
end
def tag_group tag_group
TagGroupRepr.tag_group(tag_group).merge('resource_type' => 'tag_group')
end
def autolink_tag locale, tag_id:, description_id:, name:, language:
{ resource_type: 'tag_description',
resource_id: description_id,
tag_id:,
tag_description_id: description_id,
name:,
language_code: language,
locale_code: locale.code_before_type_cast }
end
def autolink_group locale, id:, name:, language:
{ resource_type: 'tag_group',
resource_id: id,
tag_id: nil,
tag_description_id: nil,
name: "#{ TagGroupRepr::PREFIX }#{ name }",
language_code: language,
locale_code: locale.code_before_type_cast }
end
end