-
Notifications
You must be signed in to change notification settings - Fork 80
Hardware→Outpost: in-app notification instead of the after-recording popup #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # One-off sweep to drop the "hardware moved to Outpost" notice into the inbox of | ||
| # everyone who already owns a hardware project — not just those who go on to | ||
| # record a timelapse (LookoutSessionsController#create fires the same notice for | ||
| # that path). New hardware projects can't be created on Stardance anymore | ||
| # (creation is redirected to Outpost), so this audience is a fixed set; run once | ||
| # when the feature is live. | ||
| # | ||
| # HardwareMovedToOutpost is aggregatable, so a user who already has an unread | ||
| # copy (e.g. from recording) just gets it bumped, not duplicated. notify() also | ||
| # self-gates on the notification system's own rollout flag (week_2_release), so | ||
| # users without it are skipped. | ||
| # | ||
| # DRY RUN BY DEFAULT: logs how many users it would notify and writes nothing. | ||
| # Pass dry_run: false to actually create the notifications. | ||
| class OneTime::BackfillHardwareOutpostNotificationsJob < ApplicationJob | ||
| queue_as :literally_whenever | ||
|
|
||
| def perform(dry_run: true) | ||
| user_ids = Project::Membership | ||
| .where(project_id: Project.where.not(hardware_stage: nil).select(:id)) | ||
| .distinct | ||
| .pluck(:user_id) | ||
|
|
||
| Rails.logger.info("[BackfillHardwareOutpost] #{user_ids.size} hardware-project users (dry_run: #{dry_run})") | ||
| return if dry_run | ||
|
|
||
| notified = 0 | ||
| User.where(id: user_ids).find_each do |user| | ||
| notified += 1 if Notifications::HardwareMovedToOutpost.notify(recipient: user) | ||
| end | ||
| Rails.logger.info("[BackfillHardwareOutpost] notified #{notified} of #{user_ids.size} users") | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| module Notifications | ||
| # Heads-up that hardware projects live on Hack Club Outpost now, surfaced when | ||
| # a hardware project records a Lookout timelapse (replaces the old on-recorder | ||
| # popup). Inbox-only (low priority — no Slack/email), and aggregatable so a | ||
| # builder who records repeatedly keeps a single unread notice rather than a | ||
| # pile of them. | ||
| class HardwareMovedToOutpost < ::Notification | ||
| self.default_priority = :low | ||
| self.aggregatable = true | ||
| self.category_key = :hardware_moved_to_outpost | ||
| self.category_label = "Hardware moved to Outpost" | ||
| self.category_description = "Hardware projects have moved to Hack Club Outpost" | ||
| self.category_group = "General" | ||
|
|
||
| def preview_text | ||
| "Building hardware? It all happens over on Hack Club Outpost now." | ||
| end | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing aggregate group keyMedium Severity
Reviewed by Cursor Bugbot for commit 7d92c89. Configure here. |
||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <span class="notifications-item__verb">Hardware projects have moved to</span> | ||
| <%= link_to "Hack Club Outpost", "https://outpost.hackclub.com", | ||
| class: "notifications-item__actor", | ||
| target: "_blank", rel: "noopener" %> |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timelapse nudge lost without inbox
Medium Severity
The recorder Outpost modal was removed for users with only
hardware_to_outpost, while the replacement notification is skipped unlessweek_2_releaseis enabled for the recipient insideNotification.notify. Those users no longer get any timelapse Outpost nudge.Additional Locations (1)
app/views/projects/lookout_sessions/record.html.erb#L171-L176Reviewed by Cursor Bugbot for commit 7d92c89. Configure here.