Skip to content

Commit 12216a8

Browse files
sethherrclaude
andcommitted
Restore what the main merge resurrected
b_param.rb auto-merged without a conflict and kept this branch's side of lines main had deleted, so the whole register-flow confirmation-token machinery came back: PARTIAL_REGISTRATION_ORIGINS with register_flow in it (main narrowed partial_registration? to embed_partial), register_flow?, confirmation_token and its before_create, plus the emailed-link branch in the partial registration email. All of it is dead - main dropped that link. CleanBParamsJob's 3-day window came along the same way; main kept 24 hours, and it isn't this branch's change to carry. Also resets eleven cassettes this branch had committed timestamp churn into. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d23d645 commit 12216a8

14 files changed

Lines changed: 120 additions & 141 deletions

app/components/emails/partial_registration/component.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,7 @@ def color_and_brand
2323
end
2424

2525
def tokenized_url
26-
return OrganizedServices::EmailPreview::TOKEN_PATH if @email_preview
27-
28-
if @b_param.register_flow?
29-
register_url(b_param_token: @b_param.id_token,
30-
confirmation_token: @b_param.confirmation_token)
31-
else
32-
new_bike_url(b_param_token: @b_param.id_token)
33-
end
26+
@email_preview ? OrganizedServices::EmailPreview::TOKEN_PATH : new_bike_url(b_param_token: @b_param.id_token)
3427
end
3528

3629
def organization_snippet_body

app/jobs/clean_b_params_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def self.frequency
66
end
77

88
def self.clean_before
9-
Time.current - 3.days
9+
Time.current - 24.hours
1010
end
1111

1212
def perform

app/models/b_param.rb

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
# b_param stands for Bike param
3333
class BParam < ApplicationRecord
34-
PARTIAL_REGISTRATION_ORIGINS = %w[embed_partial register_flow].freeze
3534
# TODO: #3952 - stolen record legacy attrs, to support accepting the old names
3635
LEGACY_STOLEN_ATTRS = {"address" => "street", "zipcode" => "postal_code", "state_id" => "region_record_id"}.freeze
3736
REGISTRATION_INFO_ATTRS = %w[
@@ -85,13 +84,12 @@ class BParam < ApplicationRecord
8584
serialize :bike_errors, coder: YAML
8685

8786
before_create :generate_id_token
88-
before_create :generate_confirmation_token, if: :register_flow?
8987
before_save :clean_params
9088

9189
scope :with_bike, -> { where.not(created_bike_id: nil) }
9290
scope :without_bike, -> { where(created_bike_id: nil) }
9391
scope :without_creator, -> { where(creator_id: nil) }
94-
scope :partial_registrations, -> { where(origin: PARTIAL_REGISTRATION_ORIGINS) }
92+
scope :partial_registrations, -> { where(origin: "embed_partial") }
9593
scope :bike_params, -> { where("(params -> 'bike') IS NOT NULL") }
9694
scope :bike_params_empty, -> { where("(params -> 'bike') IS NULL") } # failsafe, shouldn't happen!
9795
# register/new shells whose step 1 was never submitted (manufacturer is required
@@ -426,17 +424,7 @@ def manufacturer
426424
end
427425

428426
def partial_registration?
429-
PARTIAL_REGISTRATION_ORIGINS.include?(origin)
430-
end
431-
432-
def register_flow?
433-
origin == "register_flow"
434-
end
435-
436-
# Only sent in the partial registration email - unlike id_token, the anonymous
437-
# registrant never sees it, so presenting it proves control of the email
438-
def confirmation_token
439-
params["confirmation_token"]
427+
origin == "embed_partial"
440428
end
441429

442430
def email_confirmed?
@@ -644,10 +632,6 @@ def generate_id_token
644632
self.id_token ||= SecurityTokenizer.new_token
645633
end
646634

647-
def generate_confirmation_token
648-
self.params = params.merge("confirmation_token" => SecurityTokenizer.new_token)
649-
end
650-
651635
def parking_notification_params
652636
return nil unless params&.dig("parking_notification").present?
653637

spec/vcr_cassettes/StripeSubscription-create_for-invalid_user_id.yml

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/vcr_cassettes/StripeSubscription-create_for-success.yml

Lines changed: 19 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/vcr_cassettes/bike_book_integration-comotion.yml

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)