Skip to content

管理者とメンターが休会から復帰したユーザーの休会情報を確認できるようにした#9666

Open
s-tone-gs wants to merge 26 commits intomainfrom
feature/hibernation_info_remain_displayed_after_comeback
Open

管理者とメンターが休会から復帰したユーザーの休会情報を確認できるようにした#9666
s-tone-gs wants to merge 26 commits intomainfrom
feature/hibernation_info_remain_displayed_after_comeback

Conversation

@s-tone-gs
Copy link
Copy Markdown
Contributor

@s-tone-gs s-tone-gs commented Feb 18, 2026

Issue

概要

  • 管理者とメンターが休会経験のあるユーザーの休会履歴をプロフィールから常に閲覧できるようにし、表示項目を変更した。
  • 休会経験のあるユーザーのダッシュボードに休会履歴が表示されるようにした。

変更確認方法

管理者とメンターが休会ユーザーと復帰ユーザーの休会履歴をプロフィールから閲覧できる

  1. feature/hibernation_info_remain_displayed_after_comebackをローカルに取り込む
  2. 開発サーバーを起動する
  3. rails db:seedを実行
  4. 管理者(komagata)でログイン
  • komagata
  • testtest
  1. 休会中ユーザーkyuukaiのプロフィールページ にアクセスする
  2. プロフィールの「休会履歴」に以下の情報があることを確認する
  • 休会回数
    • 「休会履歴(n回)」という形で表示されている
  • 現在の休会情報
    • 「現在n回目の休会中」という項目が存在する
    • 以下の情報が項目の中に存在する
      • 休会開始日時
      • 復帰予定日時
      • 休会期限日時
      • 休会の理由
  • 過去の休会情報
    • 「n回目の休会」 という項目が存在する
    • 以下の情報が項目の中に存在する
      • 休会期間
      • 休会の理由
  1. 復帰ユーザーのhukkiのプロフィールページにアクセスする
  2. プロフィールの「休会履歴」に以下の情報があることを確認する
  • 休会回数
    • 「休会履歴(n回)」という形で表示されている
  • 過去の休会情報
    • 「n回目の休会」 という項目が存在する
    • 以下の情報が項目の中に存在する
      • 休会期間
      • 休会の理由
  1. 休会したことが無いユーザーhajimeのプロフィールページにアクセスする
  2. 休会履歴が表示されていないことを確認する。
  3. メンター(mentormentaro)でログインし、上記手順の4~10を行う
  • mentormentaro
  • testtest
  1. メンターと管理者以外のユーザーでログインする
  1. 復帰ユーザーのhukkiのプロフィールページ にアクセスする
  2. 休会履歴が表示されていないことを確認する

休会経験のあるユーザーのダッシュボードに休会履歴が表示される

  1. 復帰ユーザーでログイン
  1. ダッシュボードにアクセスする
  2. 休会履歴として以下の情報が表示されていることを確認する。
  • 休会回数
    • 「休会履歴(n回)」という形で表示されている
  • 過去の休会情報
    • 「n回目の休会」 という項目が存在する
    • 以下の情報が項目の中に存在する
      • 休会期間
      • 休会の理由
  1. 休会履歴の無いユーザーでログイン
  1. ダッシュボードにアクセスする
  2. 休会履歴が表示されていないことを確認する

Screenshot

変更前

プロフィールページ

  • 休会中ユーザー
スクリーンショット 2026-03-10 152127
  • 復帰ユーザー
スクリーンショット 2026-03-10 152235

ダッシュボード

スクリーンショット 2026-03-10 155236

変更後

プロフィールページ

  • 休会中ユーザー
スクリーンショット 2026-03-12 092325
  • 復帰ユーザー
スクリーンショット 2026-03-10 152359

ダッシュボード

スクリーンショット 2026-03-10 155155

捕捉

以下のissueも同時に対応した
#9719

Summary by CodeRabbit

  • 新機能
    • ダッシュボードとユーザープロフィールに休会履歴を表示(管理者・メンター向けの条件付き表示を含む)
    • ユーザー非公開情報を整理し、ステータス変更操作や卒業後の進路/キャリアメモ表示を追加
  • スタイル
    • ユーザーメタ間の余白を調整、カードフッターの高さ制約を調整
  • テスト
    • 休会履歴表示のシステムテストおよびプロフィール表示に関するテストを追加
  • Chores
    • 開発/テスト用データを追加・更新しました

@s-tone-gs s-tone-gs self-assigned this Feb 18, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 18, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

ユーザーの休会履歴表示を追加。User に判定/集計メソッドを追加し、ダッシュボードとプロファイルに新パーシャルを導入、旧パーシャル削除、関連CSS/フィクスチャ/システムテストを更新しました。

Changes

Cohort / File(s) Summary
CSS スタイル調整
app/assets/stylesheets/application/blocks/user/_user-metas.css, app/assets/stylesheets/shared/blocks/card/_card-footer.css
.user-metas + .user-metas { margin-top: 1rem; } を追加。media query 内で .card-footermin-height: 3rem を削除(レイアウト微調整)。
User モデル拡張
app/models/user.rb
ever_hibernated?hibernation_count の2メソッドを追加(休会判定と回数取得)。
ビュー:休会履歴表示
app/views/users/_hibernation_history.html.slim, app/views/home/index.html.slim, app/views/users/show.html.slim
ダッシュボードとプロフィールに休会履歴パーシャルを追加。プロフィールのプライベート情報をメンター専用カードへ再編成し、ステータス変更・キャリア情報カードを追加。
ビュー削除
app/views/users/_hibernation_info.html.slim
旧休会情報パーシャルを削除し、新パーシャルへ統合。
ローカライズ調整
config/locales/ja.yml
ja.enums.emotion のインデント修正(内容は不変)。
フィクスチャ追加/修正(db / test)
db/fixtures/users.yml, db/fixtures/hibernations.yml, db/fixtures/discord_profiles.yml, db/fixtures/talks.yml, test/fixtures/users.yml, test/fixtures/hibernations.yml, test/fixtures/discord_profiles.yml, test/fixtures/talks.yml
テスト用ユーザー hukki と関連する休会/discord/talks レコードを追加。無効な日付行を修正/削除。
システムテスト追加/更新
test/system/home/hibernation_history_test.rb, test/system/users/profile_test.rb, test/system/user/courses_test.rb
ダッシュボード・プロフィールでの休会履歴表示テストを追加。コース表示件数期待値を更新。

Sequence Diagram(s)

sequenceDiagram
    participant Browser as ブラウザ
    participant Rails as Rails サーバ
    participant DB as データベース

    Browser->>Rails: ダッシュボード/プロフィールをリクエスト
    Rails->>DB: current_user / user.hibernations を取得
    DB-->>Rails: hibernation レコード集合
    Rails->>Rails: ever_hibernated? / hibernation_count を評価
    Rails-->>Browser: _hibernation_history を含む HTML を返す
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 分

Possibly related issues

Possibly related PRs

Suggested reviewers

  • machida
  • komagata

Poem

🐰✨ 休会の頁をひとつ描いたよ
過去と今がカードに並ぶよ
ちいさな間隔で見やすくしてみた
記録は静かに、でも確かにあるよ
みんなの休みも、ここで光るよ 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトルは、管理者とメンターが休会から復帰したユーザーの休会情報を確認できるようにしたという主要な変更内容を簡潔かつ明確に説明しており、変更内容と完全に関連している。
Description check ✅ Passed PRの説明は必要なセクション(Issue、概要、変更確認方法、スクリーンショット)をすべて含み、詳細な確認手順と視覚的な変更内容を適切に記載している。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/hibernation_info_remain_displayed_after_comeback

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.

@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@machida
お疲れ様です!
復帰ユーザーのプロフィールにおける「休会情報」の表示項目について、すでに確定している仕様や要望はありますでしょうか?
未確定であれば情報の利用用途を整理した上で検討したいです!

現在の実装

現在は

  • 復帰予定日
  • 休会の理由

を表示させています。休会ユーザーのプロフィールで表示される項目とほぼ同じです。
他に表示したい項目、もしくは削除したい項目(個人的には復帰予定日はあまり必要性が無いように感じています)があれば教えていただきたいです!よろしくお願いいたします🙇‍♂️
image

※参考:休会ユーザーの表示
image

@machida
Copy link
Copy Markdown
Member

machida commented Feb 18, 2026

@s-tone-gs

質問ありがとうございます!!
全体の傾向なども知りたいので、情報は全て表示したいと思います。
情報を見やすくさせるために、以下のように表示をお願いしたいです。

貼り付けた画像_2026_02_18_12_07

上記の例だと、

  • 1回目、2回目の休会が、「過去の休会」の表示
  • 3回目の休会が、「現在休会中」の表示

になります。

@s-tone-gs s-tone-gs force-pushed the feature/hibernation_info_remain_displayed_after_comeback branch 2 times, most recently from 1d3aa01 to 51b663d Compare February 24, 2026 05:41
@s-tone-gs s-tone-gs force-pushed the feature/hibernation_info_remain_displayed_after_comeback branch 2 times, most recently from eb9ce48 to 40e289b Compare February 27, 2026 02:44
@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@machida
お疲れ様です!
復帰ユーザー本人のダッシュボードに休会回数を表示する機能ですが、復帰ユーザー以外の場合は「休会回数」という欄自体が表示されない形で実装しました
こちらで問題なかったでしょうか?

問題無ければデザインをお願いしたいです🙇‍♂️

@machida
Copy link
Copy Markdown
Member

machida commented Feb 27, 2026

それでOKですー
デザイン了解です👍

@machida
Copy link
Copy Markdown
Member

machida commented Mar 3, 2026

@s-tone-gs

休会履歴があるユーザーのダッシュボード

貼り付けた画像_2026_03_04_1_37

この部分に入れるものについて説明します。

休会履歴があるユーザー個別ページに管理者でログインしてアクセスすると、今回デザインを入れて、このような表示になっています。

image

ちなみに、休会履歴があり、現在も休会中のユーザーの場合は、このような表示になっています。

image

休会履歴があるユーザー個別ページに表示されるものを、休会情報から休会履歴にタイトルを変えて、休会履歴があるユーザーのダッシュボードに表示してほしいです。

貼り付けた画像_2026_03_04_1_41

@s-tone-gs

This comment was marked as duplicate.

@machida
Copy link
Copy Markdown
Member

machida commented Mar 6, 2026

📝 今日話してユーザー画面もダッシュボードも休会履歴で統一することにしました。

@s-tone-gs s-tone-gs force-pushed the feature/hibernation_info_remain_displayed_after_comeback branch 3 times, most recently from bba4b30 to 3fdb1a6 Compare March 10, 2026 05:58
@s-tone-gs s-tone-gs marked this pull request as ready for review March 10, 2026 06:55
@github-actions github-actions bot requested a review from komagata March 10, 2026 06:56
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: 6

Caution

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

⚠️ Outside diff range comments (2)
test/fixtures/users.yml (2)

1033-1049: ⚠️ Potential issue | 🔴 Critical

重大: pjord キーも重複しています。

pjord キーがファイル内で重複しています(Line 962-982 と Line 1033-1049)。このフィクスチャも同様に、後の定義が前の定義を上書きします。

いずれかの重複エントリを削除してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/fixtures/users.yml` around lines 1033 - 1049, The YAML fixture contains
a duplicated top-level key "pjord"; remove one of the duplicate "pjord" entries
so only a single definition remains (choose to keep either the earlier or the
later block and delete the other), ensuring the remaining entry preserves the
intended fields (login_name, email, crypted_password, salt, name, company,
admin/adviser flags, timestamps) and that YAML indentation and formatting remain
valid after removal.

852-867: ⚠️ Potential issue | 🔴 Critical

YAMLキーの重複を確認しました。

neverlogin キーがファイル内で重複しています(Line 792-805 と Line 852-867)。YAMLでは後の定義が前の定義を上書きするため、最初の neverlogin フィクスチャが無効になります。また、2番目の定義には country_codesubdivision_code フィールドが追加されているため、最初の定義は完全にアクセス不可能になります。

重複しているエントリの1つを削除してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/fixtures/users.yml` around lines 852 - 867, The YAML file contains a
duplicated fixture key "neverlogin" (two entries: one around lines ~792-805 and
another ~852-867) causing the first definition to be overwritten; remove or
consolidate one of the "neverlogin" entries so only a single fixture with that
key remains (either delete the redundant block or merge its unique fields such
as country_code and subdivision_code into the remaining "neverlogin" fixture).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/views/users/_hibernation_history.html.slim`:
- Around line 1-5: The is_self check uses Ruby's object identity method
user.equal?(current_user) which fails when two distinct instances represent the
same DB user; change the check in the template to compare identities by value
(e.g., compare user.id to current_user&.id or use user == current_user) so that
is_self correctly reflects the same logical user even when instances differ;
update the assignment where is_self is defined (the line setting is_self) to use
that value-based comparison and handle possible nil current_user safely.

In `@config/locales/ja.yml`:
- Around line 144-146: The added I18n key hibernation.period is unused because
the partial _hibernation_history.html.slim still has hardcoded "休会期間" and
"休会予定期間"; replace those hardcoded strings with
Hibernation.human_attribute_name(:period) (or the appropriate localized label
for planned period) in the two occurrences so they use the hibernation.period
translation, or if you intentionally don't want a :period label remove the
hibernation.period key from config/locales/ja.yml to avoid dead translations.

In `@db/fixtures/discord_profiles.yml`:
- Around line 339-342: The YAML contains a duplicate top-level key
discord_profile_new-mentor (one at line ~334 and another for hukki), which
causes the earlier entry to be overwritten; fix this by renaming the second key
to a unique identifier (e.g., discord_profile_hukki or
discord_profile_new-mentor-hukki) or merge the hukki data into the existing
discord_profile_new-mentor entry, and ensure the renamed key still references
the hukki user and correct fields (user: hukki, account_name: hukki-taro,
times_url: ...).

In `@db/fixtures/users.yml`:
- Line 295: users.yml のシードデータで unsubscribe_email_token が hatsuno
ユーザーと重複しているため(同じ値 k3a49_NwgTsiJS0oHGU2Fw が設定されている)、一意性制約違反を避けるため該当ユーザーの
unsubscribe_email_token をユニークなトークン値に差し替えてください; 変更対象は users.yml の該当レコードの
unsubscribe_email_token フィールドで、新しいランダムまたは生成済みの一意値を設定して他レコードと重複しないことを確認してください。

In `@test/system/home/hibernation_history_test.rb`:
- Around line 5-6: The test class name in
test/system/home/hibernation_history_test.rb is mismatched: change class
HibernationCountTest to HibernationHistoryTest so it matches the filename and PR
title; update any internal references or test helpers that reference
HibernationCountTest (e.g., class declaration in the file and any usages in
other tests or setup/teardown hooks) and leave the superclass
ApplicationSystemTestCase unchanged.

In `@test/system/users/profile_test.rb`:
- Line 215: Rename the test declaration that currently reads "shold not show
hibernation history on user profile when user has never hibernated" to "should
not show hibernation history on user profile when user has never hibernated" by
correcting the typo in the test name string in the test 'shold not show
hibernation history on user profile when user has never hibernated' declaration
so the test description is spelled correctly.

---

Outside diff comments:
In `@test/fixtures/users.yml`:
- Around line 1033-1049: The YAML fixture contains a duplicated top-level key
"pjord"; remove one of the duplicate "pjord" entries so only a single definition
remains (choose to keep either the earlier or the later block and delete the
other), ensuring the remaining entry preserves the intended fields (login_name,
email, crypted_password, salt, name, company, admin/adviser flags, timestamps)
and that YAML indentation and formatting remain valid after removal.
- Around line 852-867: The YAML file contains a duplicated fixture key
"neverlogin" (two entries: one around lines ~792-805 and another ~852-867)
causing the first definition to be overwritten; remove or consolidate one of the
"neverlogin" entries so only a single fixture with that key remains (either
delete the redundant block or merge its unique fields such as country_code and
subdivision_code into the remaining "neverlogin" fixture).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cd87108c-5ef9-4625-b685-70e6364e1b62

📥 Commits

Reviewing files that changed from the base of the PR and between b9d6f27 and 3fdb1a6.

📒 Files selected for processing (21)
  • app/assets/stylesheets/application/blocks/user/_user-metas.css
  • app/assets/stylesheets/shared/blocks/card/_card-footer.css
  • app/decorators/user_decorator/retire.rb
  • app/models/user.rb
  • app/views/home/index.html.slim
  • app/views/users/_hibernation_history.html.slim
  • app/views/users/_hibernation_info.html.slim
  • app/views/users/show.html.slim
  • config/locales/ja.yml
  • db/fixtures/discord_profiles.yml
  • db/fixtures/hibernations.yml
  • db/fixtures/talks.yml
  • db/fixtures/users.yml
  • test/decorators/user_decorator/retire_test.rb
  • test/fixtures/discord_profiles.yml
  • test/fixtures/hibernations.yml
  • test/fixtures/talks.yml
  • test/fixtures/users.yml
  • test/system/home/hibernation_history_test.rb
  • test/system/user/courses_test.rb
  • test/system/users/profile_test.rb
💤 Files with no reviewable changes (1)
  • app/views/users/_hibernation_info.html.slim

@s-tone-gs s-tone-gs force-pushed the feature/hibernation_info_remain_displayed_after_comeback branch from 3fdb1a6 to 896c546 Compare March 11, 2026 04:16
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: 3

🧹 Nitpick comments (2)
app/models/user.rb (1)

682-684: any? の使用を検討してください

!hibernations.empty? は動作しますが、Rails では hibernations.any? の方がより慣用的です。

♻️ 修正案
 def ever_hibernated?
-  !hibernations.empty?
+  hibernations.any?
 end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/models/user.rb` around lines 682 - 684, Replace the implementation of the
ever_hibernated? method to use the Rails idiom hibernations.any? instead of
negating empty?; locate the ever_hibernated? method in the User model and change
its body from using !hibernations.empty? to hibernations.any? so the code is
more idiomatic and clearer.
test/system/home/hibernation_history_test.rb (1)

13-18: より堅牢なアサーションへの変更を検討

assert_no_selector で特定の回数 '休会履歴(1回)' を指定していますが、存在しないことを確認するなら回数に依存しないアサーションの方が堅牢です。

♻️ 修正案
 test 'should not show hibernation history on dashboard when logged in user never hibernated' do
   visit_with_auth '/', 'kimura'
   assert_selector '.page-header__title', text: 'ダッシュボード'
-  assert_no_selector '.card-header__title', text: '休会履歴(1回)'
-  assert_no_selector '.user-metas__title', text: '1回目の休会'
+  assert_no_selector '.card-header__title', text: /休会履歴/
+  assert_no_selector '.user-metas__title', text: /回目の休会/
 end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/system/home/hibernation_history_test.rb` around lines 13 - 18, The test
method should not assert absence of a specific occurrence label '(1回)'; update
the assertions to assert absence of the generic hibernation section/labels
instead. In the test 'should not show hibernation history on dashboard when
logged in user never hibernated', replace or change the assert_no_selector calls
that look for '.card-header__title' text: '休会履歴(1回)' and '.user-metas__title'
text: '1回目の休会' to assert_no_selector for the generic header text '休会履歴' (or a
regex matching '休会') using the same selectors (or assert_no_selector on a more
specific hibernation container if one exists), keeping visit_with_auth and the
page-header assertion unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/decorators/user_decorator/retire.rb`:
- Line 19: The retire_deadline method currently returns only the countdown
(countdown variable) while the view label reads "休会期限日時"; update the view label
to reflect the actual return value (e.g., change "休会期限日時" to "自動退会" or "自動退会予定")
so it matches retire_deadline's behavior, or alternatively adjust
retire_deadline to include scheduled_retire_at if you prefer keeping the
existing label; reference retire_deadline and scheduled_retire_at when making
the change.

In `@db/fixtures/discord_profiles.yml`:
- Around line 339-342: The fixture discord_profile_hukki in
db/fixtures/discord_profiles.yml uses account_name "hukki-taro", which violates
the DiscordProfile validation regex /\A[\w.]+\z/ in
app/models/discord_profile.rb; update the account_name value to a valid form
(e.g., replace the hyphen with an underscore or dot such as "hukki_taro" or
"hukki.taro") so the fixture passes the model validation when seeding/tests run.

In `@test/system/home/hibernation_history_test.rb`:
- Around line 7-11: テスト "show my hibernation history on dashboard"
がフィクスチャ(hibernation3 と hibernation4 により hukki
に2件の休会がある)と不整合で失敗するので、テスト内のアサーションをフィクスチャに合わせて修正してください:visit_with_auth '/',
'hukki' の後でカードヘッダーの件数表示を '休会履歴(2回)' にし、ユーザーメタのタイトル等('.user-metas__title')も
1回目ではなく適切な表示(例えば '1回目の休会' と '2回目の休会' を検証するか、最新の2件を正しく反映する内容)に合わせて更新してください。Ensure
you update the assertions referencing the test name and selectors in this test
to match the fixture records hibernation3 and hibernation4.

---

Nitpick comments:
In `@app/models/user.rb`:
- Around line 682-684: Replace the implementation of the ever_hibernated? method
to use the Rails idiom hibernations.any? instead of negating empty?; locate the
ever_hibernated? method in the User model and change its body from using
!hibernations.empty? to hibernations.any? so the code is more idiomatic and
clearer.

In `@test/system/home/hibernation_history_test.rb`:
- Around line 13-18: The test method should not assert absence of a specific
occurrence label '(1回)'; update the assertions to assert absence of the generic
hibernation section/labels instead. In the test 'should not show hibernation
history on dashboard when logged in user never hibernated', replace or change
the assert_no_selector calls that look for '.card-header__title' text:
'休会履歴(1回)' and '.user-metas__title' text: '1回目の休会' to assert_no_selector for the
generic header text '休会履歴' (or a regex matching '休会') using the same selectors
(or assert_no_selector on a more specific hibernation container if one exists),
keeping visit_with_auth and the page-header assertion unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 34ceba03-6d38-4495-9ec1-6fd2b4132701

📥 Commits

Reviewing files that changed from the base of the PR and between 3fdb1a6 and 896c546.

📒 Files selected for processing (21)
  • app/assets/stylesheets/application/blocks/user/_user-metas.css
  • app/assets/stylesheets/shared/blocks/card/_card-footer.css
  • app/decorators/user_decorator/retire.rb
  • app/models/user.rb
  • app/views/home/index.html.slim
  • app/views/users/_hibernation_history.html.slim
  • app/views/users/_hibernation_info.html.slim
  • app/views/users/show.html.slim
  • config/locales/ja.yml
  • db/fixtures/discord_profiles.yml
  • db/fixtures/hibernations.yml
  • db/fixtures/talks.yml
  • db/fixtures/users.yml
  • test/decorators/user_decorator/retire_test.rb
  • test/fixtures/discord_profiles.yml
  • test/fixtures/hibernations.yml
  • test/fixtures/talks.yml
  • test/fixtures/users.yml
  • test/system/home/hibernation_history_test.rb
  • test/system/user/courses_test.rb
  • test/system/users/profile_test.rb
💤 Files with no reviewable changes (1)
  • app/views/users/_hibernation_info.html.slim
✅ Files skipped from review due to trivial changes (1)
  • test/fixtures/talks.yml
🚧 Files skipped from review as they are similar to previous changes (10)
  • app/assets/stylesheets/application/blocks/user/_user-metas.css
  • test/decorators/user_decorator/retire_test.rb
  • db/fixtures/users.yml
  • db/fixtures/talks.yml
  • app/views/home/index.html.slim
  • config/locales/ja.yml
  • test/fixtures/hibernations.yml
  • test/system/users/profile_test.rb
  • app/assets/stylesheets/shared/blocks/card/_card-footer.css
  • app/views/users/_hibernation_history.html.slim

@s-tone-gs s-tone-gs force-pushed the feature/hibernation_info_remain_displayed_after_comeback branch from 896c546 to 4a5a3bc Compare March 12, 2026 00:19
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: 2

Caution

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

⚠️ Outside diff range comments (1)
test/fixtures/users.yml (1)

852-867: ⚠️ Potential issue | 🔴 Critical

test/fixtures/users.yml に重複するYAMLキーが存在します。

neverloginキーがLine 792とLine 852で、pjordキーがLine 962とLine 1033で重複して定義されています。YAMLでは後の定義が前の定義を上書きするため、テストデータの一貫性が失われます。

修正案:重複キーの削除

重複しているエントリを削除してください:

  • Line 852-867のneverloginブロックを削除(またはLine 792-805を削除)
  • Line 1033-1049のpjordブロックを削除(またはLine 962-983を削除)

内容を比較して、正しい方を残してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/fixtures/users.yml` around lines 852 - 867, The users.yml fixture
contains duplicate YAML mapping keys causing later entries to overwrite earlier
ones; locate the two duplicated top-level user keys "neverlogin" (the blocks
starting at the earlier and later neverlogin entries) and "pjord" and remove the
unwanted duplicates so each user key appears only once—compare the two versions
of each block (neverlogin and pjord) and keep the correct/desired block,
deleting the other to restore consistent test data.
🧹 Nitpick comments (1)
test/system/user/courses_test.rb (1)

12-16: 件数の固定値が fixture 追加に引きずられやすいです。

この PR でも別機能のユーザー追加に合わせて 3132 を直しているので、この期待値は壊れやすいです。ここは件数そのものを固定せず、対象ユーザーの表示/非表示を主に見るか、fixture から組み立てた期待値を使う方が保守しやすいです。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/system/user/courses_test.rb` around lines 12 - 16, In the test "show
users sorted by rails course" avoid the brittle fixed count assertion; instead
replace assert_selector '.users-item', count: 24 with a dynamic check that
derives the expected count from fixtures or asserts presence/absence of specific
users — e.g., load the Rails-course users via the same fixture/query used by the
app (or use fixtures(:users).select { |u| u.course == 'Rails' }.size) and
assert_selector '.users-item', count: expected_count, or simply assert_selector
'.users-item' and assert_text for a couple of known Rails users; keep references
to visit_with_auth '/users/courses', 'kimura' and the '.users-item' selector so
the test still validates the Rails tab rendering.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/views/users/_hibernation_history.html.slim`:
- Around line 15-16: The current hibernation branch always renders the element
with class user-metas.is-only-mentor (when is_hibernating and i.zero?), which
ignores the is_self check and causes mentor-only styling to appear for the
profile owner; update the conditional to mirror the else branch by including the
is_self predicate (i.zero? && is_hibernating && !is_self) so that the
.user-metas.is-only-mentor node is only rendered for non-self viewers, matching
the other branch's behavior.

In `@test/system/users/profile_test.rb`:
- Around line 183-223: The tests assert absence of a header with a hard-coded
count ('休会履歴(1回)') which will mask cases where the card is present with a
different count; update the assertions in the affected tests to check for the
header label without the count and to avoid count-specific entries. Replace
assert_no_selector '.card-header__title', text: '休会履歴(1回)' with
assert_no_selector '.card-header__title', text: '休会履歴' and replace
assert_no_selector '.user-metas__title', text: '1回目の休会' with a non-count check
such as assert_no_selector '.user-metas__title', text: '休会' (apply these changes
to the assertions around visit_with_auth calls and the 'should not show
hibernation history...' test where the same pattern appears).

---

Outside diff comments:
In `@test/fixtures/users.yml`:
- Around line 852-867: The users.yml fixture contains duplicate YAML mapping
keys causing later entries to overwrite earlier ones; locate the two duplicated
top-level user keys "neverlogin" (the blocks starting at the earlier and later
neverlogin entries) and "pjord" and remove the unwanted duplicates so each user
key appears only once—compare the two versions of each block (neverlogin and
pjord) and keep the correct/desired block, deleting the other to restore
consistent test data.

---

Nitpick comments:
In `@test/system/user/courses_test.rb`:
- Around line 12-16: In the test "show users sorted by rails course" avoid the
brittle fixed count assertion; instead replace assert_selector '.users-item',
count: 24 with a dynamic check that derives the expected count from fixtures or
asserts presence/absence of specific users — e.g., load the Rails-course users
via the same fixture/query used by the app (or use fixtures(:users).select { |u|
u.course == 'Rails' }.size) and assert_selector '.users-item', count:
expected_count, or simply assert_selector '.users-item' and assert_text for a
couple of known Rails users; keep references to visit_with_auth
'/users/courses', 'kimura' and the '.users-item' selector so the test still
validates the Rails tab rendering.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3ba13e23-335f-4ae5-be22-d2f4723f87df

📥 Commits

Reviewing files that changed from the base of the PR and between 896c546 and 4a5a3bc.

📒 Files selected for processing (19)
  • app/assets/stylesheets/application/blocks/user/_user-metas.css
  • app/assets/stylesheets/shared/blocks/card/_card-footer.css
  • app/models/user.rb
  • app/views/home/index.html.slim
  • app/views/users/_hibernation_history.html.slim
  • app/views/users/_hibernation_info.html.slim
  • app/views/users/show.html.slim
  • config/locales/ja.yml
  • db/fixtures/discord_profiles.yml
  • db/fixtures/hibernations.yml
  • db/fixtures/talks.yml
  • db/fixtures/users.yml
  • test/fixtures/discord_profiles.yml
  • test/fixtures/hibernations.yml
  • test/fixtures/talks.yml
  • test/fixtures/users.yml
  • test/system/home/hibernation_history_test.rb
  • test/system/user/courses_test.rb
  • test/system/users/profile_test.rb
💤 Files with no reviewable changes (1)
  • app/views/users/_hibernation_info.html.slim
✅ Files skipped from review due to trivial changes (1)
  • config/locales/ja.yml
🚧 Files skipped from review as they are similar to previous changes (5)
  • app/models/user.rb
  • db/fixtures/talks.yml
  • app/assets/stylesheets/application/blocks/user/_user-metas.css
  • test/fixtures/hibernations.yml
  • test/system/home/hibernation_history_test.rb

@s-tone-gs s-tone-gs force-pushed the feature/hibernation_info_remain_displayed_after_comeback branch from ccef51f to 6099f00 Compare March 12, 2026 04:25
negative: Negative
neutral: Neutral
positive: Positive
user:
Copy link
Copy Markdown
Contributor Author

@s-tone-gs s-tone-gs Mar 12, 2026

Choose a reason for hiding this comment

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

今回のPRとは関係ないですが、インデントがおかしかったので修正しました。

coderabbitai[bot]

This comment was marked as resolved.

@s-tone-gs

This comment was marked as resolved.

@coderabbitai

This comment was marked as duplicate.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2026

Tip

For best results, initiate chat on the files or code changes.

@s-tone-gs ご説明ありがとうございます。一般受講生は休会中ユーザーのプロフィールページにそもそもアクセスできないため、該当のテストが不要であるという点は理解しています。この内容はすでに長期記憶に記録済みです。ご対応ありがとうございました!


🧠 Learnings used
Learnt from: s-tone-gs
Repo: fjordllc/bootcamp PR: 0
File: :0-0
Timestamp: 2026-03-12T04:37:38.315Z
Learning: fjordllc/bootcamp では、一般受講生(admin/mentor 権限のないユーザー)は休会中ユーザーのプロフィールページにアクセスできない(アクセス制御で弾かれる)。そのため、`test/system/users/profile_test.rb` において「一般受講生が休会中ユーザーの休会履歴を閲覧できないこと」を確認するテストは不要であり、意図的に省略されている。

Learnt from: s-tone-gs
Repo: fjordllc/bootcamp PR: 9666
File: app/views/users/_hibernation_history.html.slim:15-16
Timestamp: 2026-03-12T02:58:31.535Z
Learning: `app/views/users/_hibernation_history.html.slim` において、現在休会中(`is_hibernating && i.zero?`)のブロックに `is-only-mentor` クラスが固定で付与されているのは意図的な設計である。fjordllc/bootcamp では休会中のユーザーはシステムにログインできないため、`is_self` が `true` になるケースは存在せず、現在の休会情報は常に管理者・メンターにのみ表示される。`is_self` 分岐は復帰済みユーザー(ever_hibernated?)が自分の過去の休会履歴をダッシュボードで確認できるようにするためのものであり、現在休会中ブロックには不要。

Learnt from: reckyy
Repo: fjordllc/bootcamp PR: 8356
File: db/fixtures/users.yml:823-826
Timestamp: 2025-07-15T12:33:04.885Z
Learning: fjordllc/bootcampプロジェクトでは、`trainee: true`は「研修に所属していたユーザー」全体を示すフラグであり、研修中のユーザーと研修を終了したユーザーの両方を含む。そのため、`trainee: true`と`training_completed_at`の併存は意図された仕様であり、排他的な関係ではない。

Learnt from: thmz337
Repo: fjordllc/bootcamp PR: 9103
File: app/views/generations/_user.html.slim:6-14
Timestamp: 2025-08-31T12:08:33.904Z
Learning: app/views/generations/_user.html.slimの非アクティブメッセージ表示では、退会・休会・非アクティブの3つの条件が独立して評価され、複数のメッセージが同時に表示される仕様になっている。これは意図的な設計である。

@s-tone-gs
Copy link
Copy Markdown
Contributor Author

@zamami
ありがとうございます!

@komagata
生徒間レビューが終了しましたのでメンターレビューをお願いいたします🙇‍♂️

Comment on lines +1 to +3
- is_hibernating = user.hibernated?
- total_hibernation_count = user.hibernations.count
- is_self = user == current_user
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

これらは一度変数に入れる意味があまりないようにおもいました。
もしこういうものがひつようなのであれば、decoratorやhelperでメソッド化するのが良いかなと思います。(この場合は不要だと思いますが)

Copy link
Copy Markdown
Contributor Author

@s-tone-gs s-tone-gs Apr 1, 2026

Choose a reason for hiding this comment

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

@komagata
不要な変数を削除で修正しました!ご確認お願いいたします🙇‍♂️

s-tone-gs and others added 25 commits April 1, 2026 16:25
元の仕様では復帰したユーザーの休会情報は見れなくなっていた
管理側で必要になることが多いため変更
管理者とメンターはプロフィールページから
本人はダッシュボードに表示されるようにした
休会ユーザーの傾向を確認したいため、全ての休会情報を表示したいという要望があったため
retire_deadlineメソッドは_hibernation_info.html.slim内でのみ使用されており、
変更しても他の箇所への影響はないと判断して修正した。
運用上あり得る範囲でテストデータを修正
既存のcourses_testを変更したのは、コース選択は必須であり、運用上course_idを持たないユーザーは存在しないと判断したため
また、作成当時のPRを確認したところコースの人数が正しく表示されているかを確認できればよく
ユーザーの数は増減しても問題ないと判断し、修正に踏み切った
ref: #8070
テストを軽くするため
休会情報が表示される、という機能は動かなくなっても致命的では無いので、軽さを優先してテストメソッドを一つにまとめた
逆に、表示されてはいけない人に表示される、は致命的なので、テストメソッドを分けたままにした
ユーザーkyuukaiは休会中であるのに、復帰日が存在していたため修正
画面の表記を休会情報→休会履歴に変更したことに合わせて
ファイル名もリネームした
仕様の勘違いがあり、存在しないケースで実装してしまっていた
今回は同一ユーザーであるかをチェックしたい
epaul?はRubyのオブジェクト同一性をチェックするもの
同じユーザーでも異なるオブジェクトインスタンスになる場合があるので==に修正
デザインで表示項目が変更になり、日時も必要になったため
削除した部分を復活させた
ref: 594dd0e 休会情報の表示項目を変更
アカウント名にはアンダースコアとピリオド以外の特殊文字を使用できない
休会履歴(1回)、が表示されないことをテストすると
fixtureに新しい休会レコードを追加した際も落ちてしまうため
短い処理をラップしているだけでありメソッドを別途作る理由も薄いと判断した
@s-tone-gs s-tone-gs force-pushed the feature/hibernation_info_remain_displayed_after_comeback branch from 369cf11 to 8274e6d Compare April 1, 2026 07:34
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.

5 participants