Skip to content

参加者向けアナウンス機能の追加(基本機能)#2737

Merged
jacopen merged 16 commits intomainfrom
pr1-attendee-announcements
Mar 1, 2026
Merged

参加者向けアナウンス機能の追加(基本機能)#2737
jacopen merged 16 commits intomainfrom
pr1-attendee-announcements

Conversation

@takaishi
Copy link
Contributor

@takaishi takaishi commented Feb 18, 2026

概要

参加者向けアナウンス機能の基本実装を追加するPR。
管理画面でのアナウンス作成と、参加者ダッシュボードへの表示を行う。

変更内容

機能追加

  • 参加者向けアナウンスの管理画面(作成・編集・一覧)を追加
  • 参加者ダッシュボードへのアナウンス表示を追加
  • 参加対象の絞り込みに対応
    • 全員
    • オンライン参加者のみ
    • 現地参加者のみ
    • 先行申込者(アーリーバード)

モデル変更

  • Announcement モデルに receiver enum と絞り込みロジックを追加
  • Announcement.visible_to(profile) でプロフィール属性に応じたフィルタリングを実装

DB変更

  • announcements テーブルに receiver カラムを追加

ドキュメント

  • SES配信設計ドキュメント(docs/announcements-ses.md)を追加

テスト

  • 管理画面のリクエストspec追加(spec/requests/admin/announcements_spec.rb
  • 参加者ダッシュボードの表示フィルタリングspec追加(spec/requests/attendee_dashboard/announcements_spec.rb
    • オンライン/現地 × アーリーバード有無の4パターンをすべて検証

備考

@gitops-for-cloudnativedays gitops-for-cloudnativedays bot added the reviewapps Build ReviewApp environment automatically if this label is granted label Feb 18, 2026
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Feb 18, 2026
commit: cloudnativedaysjp/dreamkast@dfc3615
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22137852269

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Feb 18, 2026
commit: cloudnativedaysjp/dreamkast@1f8f024
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22138660743

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Feb 18, 2026
commit: cloudnativedaysjp/dreamkast@85c43de
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22138958830

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Feb 18, 2026
commit: cloudnativedaysjp/dreamkast@b45df75
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22138999063

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
takaishi and others added 2 commits February 18, 2026 21:10
アナウンスのbody文字列がサブストリング関係になっており、
`not_to include` の検証が意図せず失敗していた問題を修正。

- 'announcement person online' が 'announcement person online early' のサブストリングになっていた
- 'announcement person offline' が 'announcement person offline recent' のサブストリングになっていた

person_for_online_early と person_for_offline_recent の body 文字列を
重複しない文字列に変更し、テストの assertion も合わせて更新。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Feb 21, 2026
commit: cloudnativedaysjp/dreamkast@98685aa
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22255920240

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
イシュー要件では個別通知は不要とのことで、関連コードをすべて削除。

- Announcementモデルからperson enumと関連ロジックを削除
- AnnouncementMiddleモデル・マイグレーションを削除
- Profileモデルからannouncement_middles関連を削除
- 管理画面コントローラー・フォームからprofile_ids処理を削除
- 参加者一覧のNoticeリンクを削除
- announcement_middlesテーブルをschema.rbから削除
- 関連するspecを更新

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Feb 21, 2026
commit: cloudnativedaysjp/dreamkast@dd0fd43
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22256012033

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
@takaishi takaishi marked this pull request as ready for review February 21, 2026 23:03
@takaishi takaishi requested a review from jacopen February 21, 2026 23:03
@takaishi takaishi self-assigned this Feb 21, 2026
@jacopen
Copy link
Collaborator

jacopen commented Feb 22, 2026

@claude このPRをレビューして

@claude
Copy link

claude bot commented Feb 22, 2026

Claude finished @jacopen's task in 1m 38s —— View job


PRレビュー結果

コードレビューを完了しました。全体的に良い実装ですが、いくつか改善が必要な点があります。


🔴 Critical Issues

1. enum値の不整合性 (app/models/announcement.rb:2)

enumの値に一貫性がありません:

enum :receiver, { all_attendee: 0, only_online: 2, only_offline: 3, early_bird: 4 }

all_attendee: 0の次がonly_online: 2になっており、1が欠けています。これは将来的なバグの原因になる可能性があります。

推奨修正:

enum :receiver, { all_attendee: 0, only_online: 1, only_offline: 2, early_bird: 3 }

または、既存データとの互換性が必要な場合は、コメントで理由を明記してください。

Fix this →


🟡 Important Issues

2. 成功メッセージの誤り (app/controllers/admin/announcements_controller.rb:22, 37)

createupdateアクションで'Speaker was successfully updated.'というメッセージが使われていますが、SpeakerではなくAnnouncementです:

# Line 22, 37
notice: 'Speaker was successfully updated.'

推奨修正:

# createアクションでは
notice: 'Announcement was successfully created.'

# updateアクションでは
notice: 'Announcement was successfully updated.'

Fix this →

3. バリデーション成功時の潜在的バグ (app/controllers/admin/announcements_controller.rb:21)

createアクションでAnnouncement.create(params)の結果をチェックする条件が不適切です:

@announcement = Announcement.create(params)
respond_to do |format|
  if @announcement  # バリデーションエラーがあってもtruthyになる

createはバリデーションエラーがあってもオブジェクトを返すため、if @announcementは常にtrueになります。

推奨修正:

if @announcement.persisted?
# または
if @announcement.save  # ただし、createの代わりにnew + saveを使用

Fix this →

4. N+1クエリの可能性 (app/views/admin/announcements/index.html.erb:17)

ビューでeager_load(:profiles)を使用していますが、Announcementモデルには:profilesのアソシエーションが存在しません:

<% @announcements.eager_load(:profiles).each do |announcement| %>

これは不要なクエリまたはエラーの原因になる可能性があります。

推奨修正:

<% @announcements.each do |announcement| %>

または、必要なアソシエーションがある場合はモデルに追加してください。

Fix this →

5. フィルタリングロジックの潜在的なnilエラー (app/models/announcement.rb:32)

profile.conference.early_bird_cutoff_atnilの可能性があり、その場合比較でエラーになります:

if profile.created_at < profile.conference.early_bird_cutoff_at

推奨修正:

if profile.conference.early_bird_cutoff_at && profile.created_at < profile.conference.early_bird_cutoff_at

Fix this →


🟢 Minor Issues / Suggestions

6. マイグレーションファイルが2つに分かれている理由

20260215130000_add_receiver_to_announcements.rb20260215133000_remove_default_from_announcements_receiver.rbが分かれていますが、通常は1つのマイグレーションにまとめられます。分ける必要がある場合は、コメントで理由を明記すると良いでしょう。

7. テストカバレッジ

テストは4つのパターン(オンライン/現地 × アーリーバード有無)をすべてカバーしており、素晴らしいです!

ただし、以下のテストケースも追加するとより堅牢になります:

  • 非公開アナウンスが表示されないことの確認
  • profilenilの場合の動作(attendee_dashboards_controller.rb:8のフォールバック)
  • 異なるカンファレンスのアナウンスが表示されないこと

8. enumのシンボル名の一貫性

モデルではonly_online/only_offlineですが、UI的には「オンライン参加者のみ」「現地参加者のみ」という意味です。より明確な命名としてonline_only/offline_onlyの方が英語として自然かもしれません(ただし、既存コードとの整合性を優先する場合は現状で問題ありません)。


✅ 良い点

  1. 包括的なテスト: 4つのユースケースをすべてカバーしている
  2. スコープの適切な使用: publishedスコープで公開済みアナウンスのフィルタリングが明確
  3. ビューの国際化対応: JA_RECEIVER定数で日本語表示をサポート
  4. セキュリティ: Strong Parametersで適切にパラメータを制限

📝 総評

基本的な実装は良好ですが、Critical IssuesImportant Issuesは本番環境でバグを引き起こす可能性があるため、マージ前に修正することを強く推奨します。特に:

  1. enumの値の不整合(CI作る #1
  2. バリデーションチェックのバグ(Cloud Native Buildpacksでイメージ作れるようにする #3
  3. early_bird_cutoff_atのnil対応(現在放送中のトラック情報を表示するようにする #5

これらを修正すれば、安全にマージできる状態になります。


- enum値を連続整数に修正 (only_online:1, only_offline:2, early_bird:3)
- createアクションのバリデーションチェックを persisted? に修正
- 成功メッセージを "Speaker" から "Announcement" に修正
- eager_load(:profiles) を削除(アソシエーションが存在しないため)
- early_bird_cutoff_at の nil チェックを追加

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Feb 22, 2026
commit: cloudnativedaysjp/dreamkast@fe0da2b
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22274142282

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
@github-actions github-actions bot removed the reviewapps Build ReviewApp environment automatically if this label is granted label Feb 26, 2026
@jacopen jacopen added the reviewapps Build ReviewApp environment automatically if this label is granted label Mar 1, 2026
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Mar 1, 2026
commit: cloudnativedaysjp/dreamkast@fe0da2b
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22539274864

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Mar 1, 2026
commit: cloudnativedaysjp/dreamkast@bb7f2e9
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22540226708

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Mar 1, 2026
commit: cloudnativedaysjp/dreamkast@3eea903
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22540262300

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 1, 2026

Simplecov Report

Covered Threshold
65.91% 60%

gitops-for-cloudnativedays bot added a commit to cloudnativedaysjp/dreamkast-infra that referenced this pull request Mar 1, 2026
commit: cloudnativedaysjp/dreamkast@57ca086
action URL: https://github.com/cloudnativedaysjp/dreamkast/actions/runs/22540331463

Co-authored-by: gitops-for-cloudnativedays[bot] <113280573+gitops-for-cloudnativedays[bot]@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 1, 2026

@jacopen
Copy link
Collaborator

jacopen commented Mar 1, 2026

CleanShot 2026-03-01 at 20 30 05@2x CleanShot 2026-03-01 at 20 30 38@2x

全参加者向けと現地参加者向けが出ることを確認

@jacopen
Copy link
Collaborator

jacopen commented Mar 1, 2026

profile.created_atを弄って先行参加者向けが出ることを確認
Uploading CleanShot 2026-03-01 at 20.35.15@2x.png…

@jacopen
Copy link
Collaborator

jacopen commented Mar 1, 2026

参加方法を弄ってオンライン向けが出ることを確認
CleanShot 2026-03-01 at 20 36 22@2x

@jacopen jacopen merged commit 28f72f3 into main Mar 1, 2026
8 checks passed
@jacopen jacopen deleted the pr1-attendee-announcements branch March 1, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewapps Build ReviewApp environment automatically if this label is granted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[提案]Announcement投稿時の、参加登録者へのメール配信

2 participants