Skip to content

Events.jsxを非React化#9147

Merged
komagata merged 5 commits intomainfrom
chore/migrate-event-list-to-rails-view
Oct 1, 2025
Merged

Events.jsxを非React化#9147
komagata merged 5 commits intomainfrom
chore/migrate-event-list-to-rails-view

Conversation

@sjabcdefin
Copy link
Copy Markdown
Contributor

@sjabcdefin sjabcdefin commented Sep 6, 2025

Issue

概要

  • イベント一覧機能をReactから普通のrails viewに移行しました。

変更内容

  • app/controllers/events_controller.rbでイベント一覧のデータ取得処理をするように修正
  • javascript/components/Events.jsxapp/views/events/_events.html.slimに移行。
  • app/views/events/index.html.slim_events.html.slimのrender処理を追加。
  • rails view化に伴い、不要となったファイルを削除、修正。
  • テストを修正

変更確認方法

  1. chore/migrate-event-list-to-rails-viewをローカルに取り込む
  2. foreman start -f Procfile.devでアプリを起動する
  3. 任意のユーザでログインする
  4. イベント一覧 に遷移し、以下を確認する
  • 特別イベント一覧が表示されること
  • イベント表示の基本内容として以下が表示されていること
    • ユーザアイコン
    • イベントタイトル
    • ユーザ名
    • 開催日時(例: 2025年09月07日(日) 12:00 の形式)
    • 参加者(x名 / x名)
  • WIP中のイベントは「WIP」マークがタイトル横に表示されること
  • 終了したイベントは「終了」マークがタイトル横に表示されること
  • コメントがある場合は、「参加者(x名 / x名)」横に「コメント(x)」が表示されること
  • 補欠者がいる場合は、「参加者(x名 / x名)」横に「補欠者(x名)」が表示されること
  • イベントタイトルをクリックすると、イベント詳細ページ: /events/{id} に遷移すること
  • ユーザーアイコンをクリックすると、ユーザ詳細ページ: /users/{id} に遷移すること
  • ユーザ名をクリックすると、ユーザ詳細ページ: /users/{id} に遷移すること
  • ページネーションが表示されること

Screenshot

  • 画面の変更はありませんが、動作確認時の参考としてスクリーンショットを添付いたします。
image image

Summary by CodeRabbit

  • 新機能

    • イベント一覧をサーバーレンダリングで提供。カード形式でタイトル、作成者、開催日時、参加者数/定員、補欠数、コメント数、ステータスバッジを表示
    • 上下にページネーションを追加(1ページ20件)
    • イベントがない場合の空状態メッセージを表示
  • リファクタ

    • イベント一覧のAPIエンドポイント(/api/events)を廃止

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Sep 6, 2025

Walkthrough

API の events エンドポイントと関連 Jbuilder/テスト/ルートを削除し、サーバーサイドのコントローラと Slim ビューでイベント一覧を表示する実装へ移行。EventsController にページネーション定数を追加し、index をクエリ・ページング対応に変更。システムテストを新 UI に合わせて修正。

Changes

Cohort / File(s) Summary
API エンドポイント削除
app/controllers/api/events_controller.rb, app/views/api/events/_event.json.jbuilder, app/views/api/events/index.json.jbuilder, config/routes/api.rb, test/integration/api/events_test.rb
API::EventsController を削除。/api/events のルートと Jbuilder 部分/一覧テンプレートを削除。API 統合テストを削除。
サーバーサイド一覧表示への移行
app/controllers/events_controller.rb, app/views/events/_events.html.slim, app/views/events/index.html.slim, test/system/events_test.rb
EventsController に PAGER_NUMBER=20 を追加し、index を includes/order/page/per で取得。Slim でイベントカード一覧+上下ページネーションを追加し、index で空状態と部分テンプレートを条件分岐。システムテストはクリック範囲の限定とタイポ修正。

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as Browser
  participant C as EventsController#index
  participant M as Event(Model)
  participant V as views/events/index.html.slim
  participant P as views/events/_events.html.slim

  U->>C: GET /events?page=n
  C->>M: with_avatar.includes(:comments, :users)<br/>.order(start_at: :desc).page(page).per(20)
  M-->>C: @events (paginated)
  C-->>V: render with @events
  alt @events.empty?
    V-->>U: 空状態を表示
  else
    V->>P: render 'events/events' with @events
    P-->>U: 一覧カード+ページネーションを描画
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • Events.jsxを非React化する #9044 — React によるイベント一覧をサーバーサイドへ移行する趣旨が一致し、API 廃止とコントローラ/ビュー実装への置換に対応。

Possibly related PRs

Suggested reviewers

  • komagata

Poem

ぴょんと跳ねれば API 消えた
画面にそよぐ Slim の草
ページは 20、風にのり
ならぶカードは月明かり
ぼくのヒゲにもページネーション
春の夜長に、イベントへぴょん 🐇

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed タイトル「Events.jsxを非React化」は短く明確で、主要な変更(Events.jsx を React から通常の Rails view に移行)を正確に表現しています。ファイル名と目的が示されており、履歴を眺めるだけで主旨が把握できます。
Description Check ✅ Passed プルリク説明はテンプレートの必須要素である Issue、概要、変更確認方法(ブランチ名・起動手順・具体的なチェック項目)、およびスクリーンショットを含んでおり、レビューワーが動作確認できるよう具体的に記載されています。変更内容の要約と検証手順が整っているため概ね完成しています。
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/migrate-event-list-to-rails-view

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 344bf42 and d1aa1f2.

📒 Files selected for processing (9)
  • app/controllers/api/events_controller.rb (0 hunks)
  • app/controllers/events_controller.rb (1 hunks)
  • app/views/api/events/_event.json.jbuilder (0 hunks)
  • app/views/api/events/index.json.jbuilder (0 hunks)
  • app/views/events/_events.html.slim (1 hunks)
  • app/views/events/index.html.slim (1 hunks)
  • config/routes/api.rb (0 hunks)
  • test/integration/api/events_test.rb (0 hunks)
  • test/system/events_test.rb (6 hunks)
💤 Files with no reviewable changes (5)
  • app/controllers/api/events_controller.rb
  • config/routes/api.rb
  • app/views/api/events/index.json.jbuilder
  • test/integration/api/events_test.rb
  • app/views/api/events/_event.json.jbuilder
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/controllers/events_controller.rb
  • app/views/events/index.html.slim
  • test/system/events_test.rb
  • app/views/events/_events.html.slim
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 RuboCop (1.76.1)
app/controllers/events_controller.rb

rubocop-minitest extension supports plugin, specify plugins: rubocop-minitest instead of require: rubocop-minitest in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
rubocop-capybara extension supports plugin, specify plugins: rubocop-capybara instead of require: rubocop-capybara in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
Unable to find gem rubocop-fjord; is the gem installed? Gem::MissingSpecError
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:84:in block (2 levels) in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader.rb:58:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:162:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:82:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

test/system/events_test.rb

rubocop-minitest extension supports plugin, specify plugins: rubocop-minitest instead of require: rubocop-minitest in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
rubocop-capybara extension supports plugin, specify plugins: rubocop-capybara instead of require: rubocop-capybara in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
Unable to find gem rubocop-fjord; is the gem installed? Gem::MissingSpecError
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:84:in block (2 levels) in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader.rb:58:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:162:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:82:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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 and usage tips.

@sjabcdefin sjabcdefin self-assigned this Sep 6, 2025
@sjabcdefin sjabcdefin marked this pull request as ready for review September 7, 2025 02:00
@github-actions github-actions bot requested a review from komagata September 7, 2025 02:01
@sjabcdefin sjabcdefin removed the request for review from komagata September 7, 2025 02:01
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (7)
app/controllers/events_controller.rb (2)

9-11: N+1回避と不要なeager loadの削減(:users → :user へ)

一覧ビューでは author の event.user を参照していますが、includes(:users) は多対多側(参加者)をプリロードしており重い割に未使用です。author を確実にプリロードするため :user を、コメント数のための :comments は維持で十分です。ついでに同時刻の並び順安定化で id: :desc を追加するのがおすすめです。

- @events = Event.with_avatar.includes(:comments, :users).order(start_at: :desc).page(params[:page]).per(PAGER_NUMBER)
+ @events = Event.with_avatar
+                .includes(:comments, :user)
+                .order(start_at: :desc, id: :desc)
+                .page(params[:page])
+                .per(PAGER_NUMBER)

補足:

  • 参加者/補欠者の「件数」だけを表示する用途なら includes よりも counter_cache(例: events.participants_count, events.waitlist_count)の導入が最も効きます。必要なら別PRで提案します。

4-4: ページサイズ定数の統一を検討

他Controller(例: AnnouncementsControllerの25件)と値がばらついています。Kaminariのdefault_per_page設定に寄せるか、ApplicationController::PAGER_NUMBER等で共通化すると保守が楽です。

app/views/events/index.html.slim (1)

26-34: 空状態分岐はOK。exists? で軽量化も可

現状でも問題ありませんが、空の場合のみ軽量化したいなら @events.exists? を使う手もあります(ただし存在する場合は追加クエリが増えるのでトレードオフ)。

app/views/events/_events.html.slim (3)

27-30: time要素のdatetimeはISO8601で

datetime にはISO8601文字列を渡してください。nil安全も考慮するならセーフナビゲーションを。

-                  time.a-meta(datetime=event.start_at)
+                  time.a-meta datetime=(event.start_at&.iso8601)

11-15: predicateメソッドを利用(wip → wip?)

Ruby/Rails慣例として真偽値カラムは wip? が可読性高いです。

-              - if event.wip
+              - if event.wip?

32-40: 件数取得のパフォーマンスについて(任意)

participants.count / waitlist.count はイベントごとに COUNT(*) が走ります。高トラフィック時は counter_cache の追加(例: participants_count, waitlist_count, comments_count)を検討してください。ビューはそれらを表示するだけにするとI/Oが安定します。

必要なら、migration + model修正 + 表示差し替えまでのパッチを用意します。

app/views/shared/_user_icon.html.slim (1)

3-6: localsの存在判定とlazy-loadの付与

  • defined?(login_name) より local_assigns[:login_name].present? がRails部分テンプレの慣用です。
  • 画像に loading="lazy" を付けると一覧の初期ロードが軽くなります。
-    - if defined?(login_name) && login_name.present?
-      = image_tag user.avatar_url, alt: user.icon_title, title: user.icon_title, class: img_classes, data: { 'login-name': login_name }
+    - if local_assigns[:login_name].present?
+      = image_tag user.avatar_url, alt: user.icon_title, title: user.icon_title, class: img_classes, loading: 'lazy', data: { 'login-name': login_name }
     - else
-      = image_tag user.avatar_url, alt: user.icon_title, title: user.icon_title, class: img_classes
+      = image_tag user.avatar_url, alt: user.icon_title, title: user.icon_title, class: img_classes, loading: 'lazy'
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 929040f and b42fedb.

📒 Files selected for processing (11)
  • app/controllers/api/events_controller.rb (0 hunks)
  • app/controllers/events_controller.rb (1 hunks)
  • app/javascript/components/Events.jsx (0 hunks)
  • app/views/api/events/_event.json.jbuilder (0 hunks)
  • app/views/api/events/index.json.jbuilder (0 hunks)
  • app/views/events/_events.html.slim (1 hunks)
  • app/views/events/index.html.slim (1 hunks)
  • app/views/shared/_user_icon.html.slim (1 hunks)
  • config/routes/api.rb (0 hunks)
  • test/integration/api/events_test.rb (0 hunks)
  • test/system/events_test.rb (4 hunks)
💤 Files with no reviewable changes (6)
  • app/javascript/components/Events.jsx
  • config/routes/api.rb
  • test/integration/api/events_test.rb
  • app/controllers/api/events_controller.rb
  • app/views/api/events/index.json.jbuilder
  • app/views/api/events/_event.json.jbuilder
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • test/system/events_test.rb
  • app/controllers/events_controller.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/system/events_test.rb
🧠 Learnings (1)
📓 Common learnings
Learnt from: Miya096jp
PR: fjordllc/bootcamp#9102
File: db/fixtures/buzzes.yml:0-0
Timestamp: 2025-09-04T01:27:23.422Z
Learning: The buzz_controller.rb and related data migration files were deleted as part of the Buzz page redesign, not just modified. The old single buzz page was completely replaced with a new buzzes (plural) listing page with year-based navigation and metadata structure.
🧬 Code graph analysis (1)
app/controllers/events_controller.rb (3)
app/controllers/products_controller.rb (2)
  • before_action (3-156)
  • index (8-13)
app/controllers/announcements_controller.rb (2)
  • before_action (3-119)
  • index (9-15)
app/controllers/reports_controller.rb (1)
  • index (16-20)
🔇 Additional comments (1)
test/system/events_test.rb (1)

251-254: DOMスコープの追加は適切です

within 'ul.card-list' に限定することで誤クリックを防げて安定度が上がっています。

Also applies to: 283-286, 315-318, 328-331

@sjabcdefin sjabcdefin changed the title Events.jsxを非React化する Events.jsxを非React化 Sep 7, 2025
@sjabcdefin sjabcdefin force-pushed the chore/migrate-event-list-to-rails-view branch from b42fedb to 1b490f5 Compare September 7, 2025 04:30
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
test/system/events_test.rb (2)

453-455: タイポによりアサーションが常時パスしてしまう恐れ(正規表現が空)

event[:desription] のキーが誤字です。nil が埋め込まれて //(空の正規表現)となり、意図せず常にマッチします。テストの信頼性に直結するため修正をお願いします。

適用例(diff):

-      assert has_field? 'announcement[description]', with: /#{event[:desription]}/
+      assert has_field? 'announcement[description]', with: /#{event[:description]}/

483-485: 同上:description のキー誤字を修正してください

こちらも同様の誤字により常時パスのリスクがあります。

適用例(diff):

-      assert has_field? 'announcement[description]', with: /#{event[:desription]}/
+      assert has_field? 'announcement[description]', with: /#{event[:description]}/
🧹 Nitpick comments (2)
app/views/events/index.html.slim (1)

26-33: nil/空配列両対応の判定・I18n・a11yの微修正提案

@events.empty?nil 時に例外となるため、より堅牢で慣用的な blank? を使うと安心です。あわせて空状態文言のI18n化と、アイコンに aria-hidden を付与、部分テンプレートへはローカル引数で明示的に渡すと依存関係が明確になります。

適用例(diff):

-        - if @events.empty?
+        - if @events.blank?
           .o-empty-message
             .o-empty-message__icon
-              i.fa-regular.fa-sad-tear
+              i.fa-regular.fa-sad-tear aria-hidden="true"
             p.o-empty-message__text
-              | 登録されている特別イベントはありません。
+              = t('events.index.empty') # 例: ja.views.events.index.empty
-        - else
-          = render 'events/events'
+        - else
+          = render 'events/events', events: @events

補足: 空状態ブロックは再利用が想定されるなら ViewComponent 化も検討余地ありです。

test/system/events_test.rb (1)

385-393: 空状態表示のシナリオを1本追加すると回帰防止に有効

React除去に伴い空一覧のUIが変わったため、「イベントが1件もないときに空状態メッセージが出ること」を検証するE2Eを1本追加すると安心です(既存のページネーション検証と並ぶ網羅性)。

例(概略・実装は運用中のDBリセット戦略に合わせて調整ください):

test 'show empty state message when no events exist' do
  visit_with_auth events_path, 'kimura'
  # 必要に応じてイベントを削除 or テスト用 Tenant/Fixture を用意
  assert_text '登録されている特別イベントはありません。'
end
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b42fedb and 1b490f5.

📒 Files selected for processing (10)
  • app/controllers/api/events_controller.rb (0 hunks)
  • app/controllers/events_controller.rb (1 hunks)
  • app/javascript/components/Events.jsx (0 hunks)
  • app/views/api/events/_event.json.jbuilder (0 hunks)
  • app/views/api/events/index.json.jbuilder (0 hunks)
  • app/views/events/_events.html.slim (1 hunks)
  • app/views/events/index.html.slim (1 hunks)
  • config/routes/api.rb (0 hunks)
  • test/integration/api/events_test.rb (0 hunks)
  • test/system/events_test.rb (4 hunks)
💤 Files with no reviewable changes (6)
  • test/integration/api/events_test.rb
  • app/controllers/api/events_controller.rb
  • config/routes/api.rb
  • app/views/api/events/_event.json.jbuilder
  • app/javascript/components/Events.jsx
  • app/views/api/events/index.json.jbuilder
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/controllers/events_controller.rb
  • app/views/events/_events.html.slim
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rb

⚙️ CodeRabbit configuration file

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • test/system/events_test.rb
test/**/*

⚙️ CodeRabbit configuration file

test/**/*: # Test

  • TestCase名は英語で書く。
  • どうしても避けられない時以外にsystem testでsleepは使わない。

Unit Test

model, helper, decorator, view_componentについてはメソッドを追加した場合は必ず対応したUnit TestのTestCaseを1つは書く。

Files:

  • test/system/events_test.rb
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (1)
test/system/events_test.rb (1)

252-254: クリック対象のスコープを狭めたのは良い変更です

within 'ul.card-list' で一覧DOMに限定することで、同名リンクが別領域に存在しても誤クリックを防げます。現状のDOM構造にもフィットしています。

Also applies to: 284-286, 316-318, 329-331

@sjabcdefin
Copy link
Copy Markdown
Contributor Author

@matuaya
お疲れ様です!
お手すきの際に、こちらのPRをレビューいただけると嬉しいです。😊🙏
ご負担になりそうでしたら、遠慮なく教えていただければと思います!😌👌

@sjabcdefin sjabcdefin requested a review from matuaya September 7, 2025 06:00
@matuaya
Copy link
Copy Markdown
Contributor

matuaya commented Sep 8, 2025

@sjabcdefin
お疲れ様です!
レビューのご依頼いただきありがとうございます😊
非React化に関してあまりよく理解していないので日数がかかってしまうかもしれません💦

Copy link
Copy Markdown
Contributor

@matuaya matuaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

遅くなってしまい申し訳ありません🙇‍♀️
確認いたしました!Approveさせていただきます😊
非React化の対応とても参考になりました😊

@sjabcdefin
Copy link
Copy Markdown
Contributor Author

@matuaya
ご確認いただきありがとうございました!😌🙏

@sjabcdefin sjabcdefin force-pushed the chore/migrate-event-list-to-rails-view branch from 344bf42 to d1aa1f2 Compare September 13, 2025 07:47
@sjabcdefin
Copy link
Copy Markdown
Contributor Author

@komagata
お疲れさまです。
お手すきの際に、レビューをお願いいたします。😌🙏

@sjabcdefin sjabcdefin requested a review from komagata September 13, 2025 12:40
Copy link
Copy Markdown
Member

@komagata komagata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

確認させていただきました。OKです〜!

@komagata komagata merged commit 1478511 into main Oct 1, 2025
6 checks passed
@komagata komagata deleted the chore/migrate-event-list-to-rails-view branch October 1, 2025 03:32
@github-actions github-actions bot mentioned this pull request Oct 1, 2025
16 tasks
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.

3 participants