Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Backfill contact_us_fyi communications as incoming, then drop the dual-condition checks

オープン
#2,242 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
72/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
ruby
領域
backend, databases

調査の方向性

app/models/notification.rb、contact-form/NotificationServices の作成パス、および spec/models/notification_spec.rb 内の .responded_status と #requires_response? の spec から始めます。contact_us_fyi の行は incoming であるべきだと確認した後、可逆的な backfill migration を追加し、作成処理と条件を更新してから、Notification の spec を実行し、migration の down path がガードされていることを確認します。

索引モデルが issue の本文から書いたものです。

説明

database cleanup

Context

In #2239 we extended the "needs response" concept from contact_us_fyi notifications to all incoming communications. Because existing contact_us_fyi rows are stored as direction: "outgoing", the code currently has to check both conditions:

  • Notification#requires_response? — kind == "contact_us_fyi" || incoming?
  • Notification.responded_status scope — where(kind: "contact_us_fyi").or(where(direction: "incoming")), and the "na" branch has to exclude both.

A contact_us_fyi is conceptually an incoming contact (the person reached out to us), so it should simply carry direction: "incoming". Once it does, the kind == "contact_us_fyi" half of every check is redundant and can go.

Work

  1. Create new contact_us_fyi notifications as incoming. Update wherever they're generated (contact-form flow / NotificationServices) so direction: "incoming" is set on creation. Do this first — otherwise removing the OR breaks newly-created rows.
  2. Backfill existing rows — a reversible data migration: Notification.where(kind: "contact_us_fyi", direction: "outgoing").update_all(direction: "incoming") (guard the down).
  3. Simplify the code once every contact_us_fyi is incoming:
    • requires_response? → incoming?
    • responded_status → key off direction: "incoming" only:
      • "yes" → where(direction: "incoming", responded: true)
      • "no" → where(direction: "incoming", responded: false)
      • "na" → where.not(direction: "incoming")
  4. Update specs in spec/models/notification_spec.rb (the .responded_status and #requires_response? groups) to reflect the single-condition logic.

Notes

  • Sanity-check that no contact_us_fyi should legitimately be outgoing before backfilling.
  • Files: app/models/notification.rb, plus the contact-form/notification-creation path.
主要言語
Ruby
スター
15
フォーク
28
平均マージ
1日 12分
マージ済み PR(30日)
262

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rubyforgood/awbw のほかの issue

rubyforgood/awbw の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。