Skip to content

WIP状態に応じた遷移先を返すクラスの名前と責務を明確にする - #10625

Open
Fuki3 wants to merge 3 commits into
mainfrom
chore/refactor_class_redirection_name_role
Open

Fuki3 wants to merge 3 commits into
mainfrom
chore/refactor_class_redirection_name_role

Conversation

@Fuki3

@Fuki3 Fuki3 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Issue

概要

Redirection は、リソースのWIP状態に応じて保存後の遷移先URLを返すクラスである。現在のクラス名からは具体的な責務が分かりにくいため、名前をWipRedirectUrl に変更した。

さらに、クラスの構成については、インスタンスを生成せずクラスメソッドだけでURLを返す形へ整理した。

また、スペルミスのあった公開メソッドの determin_url は、名前から責務を把握できるようにresolve に変更した。

変更確認方法

  1. chore/refactor_class_redirection_name_roleをローカルに取り込む
  2. 以下のテストを実行する
    bin/rails test test/models/wip_redirect_url_test.rb

Review App

Summary by CodeRabbit

  • 変更点
    • お知らせ、イベント、動画、ページ、予約、ペアワーク、商品、質問などの作成・更新後の遷移先を統一しました。
    • 下書きの場合は編集画面へ、それ以外の場合は通常の画面へ遷移します。告知付き公開時の遷移先は従来どおりです。
  • テスト
    • 下書きと通常のリソースそれぞれで、遷移先が正しく解決されることを確認するテストを更新しました。

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: fjordllc/bootcamp/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e5416e69-80ea-4f2a-a68a-0388220029e6
📥 Commits

Reviewing files that changed from the base of the PR and between 602a509 and e1a8116.

📒 Files selected for processing: 12
  • app/controllers/announcements_controller.rb
  • app/controllers/events_controller.rb
  • app/controllers/movies_controller.rb
  • app/controllers/pages_controller.rb
  • app/controllers/pair_works/reservations_controller.rb
  • app/controllers/pair_works_controller.rb
  • app/controllers/products_controller.rb
  • app/controllers/questions_controller.rb
  • app/controllers/regular_events_controller.rb
  • app/models/redirection.rb
  • app/models/wip_redirect_url.rb
  • test/models/wip_redirect_url_test.rb
💤 Files with no reviewable changes: 1
  • app/models/redirection.rb
📝 Walkthrough

URL解決クラスをRedirectionからWipRedirectUrlに置き換えました。複数のコントローラーとテストを新しいクラスに移行しました。下書きリソースでは編集用URLを、それ以外では通常のURLを返します。

Changes: リダイレクトURL解決の移行

Layer / File(s) Summary
URL解決クラスとテスト
app/models/redirection.rb, app/models/wip_redirect_url.rb, test/models/wip_redirect_url_test.rb
Redirectionを削除し、WipRedirectUrl.resolveを追加しました。テストも新しいクラスとメソッドを使います。
コントローラーの呼び出し変更
app/controllers/announcements_controller.rb, app/controllers/events_controller.rb, app/controllers/movies_controller.rb, app/controllers/pages_controller.rb, app/controllers/pair_works/*, app/controllers/products_controller.rb, app/controllers/questions_controller.rb, app/controllers/regular_events_controller.rb
作成・更新・削除成功時の遷移先の解決をWipRedirectUrl.resolveに変更しました。通知、条件分岐、失敗時の処理に関する変更は要約に記載されていません。

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to e1a81

WIP resources continue to redirect to their edit pages, while non-WIP resources use their regular URLs. The migration preserves this behavior and presents no identified merge risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed タイトルは、WIP状態に応じた遷移先クラスの改名と責務整理という主な変更を明確に示しています。変更内容と一致しています。
Description check Passed Issue、概要、変更確認方法を記載しています。テンプレートのScreenshotセクションはありませんが、説明は主に完成しており、確認方法も具体的です。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use path_filters to narrow the review scope.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Fuki3 Fuki3 changed the title Chore/refactor class redirection name role WIP状態に応じた遷移先を返すクラスの名前と責務を明確にする Oct 19, 2026
@Fuki3
Fuki3 marked this pull request as ready for review October 19, 2026 14:47
@Fuki3
Fuki3 requested a review from mikan-v7y October 20, 2026 13:09
@Fuki3

Fuki3 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

@mikan-v7y
おつかれさまです🙂
こちらのレビューをおねがいしたいのですが可能でしょうか😳

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant