Skip to content

Commit 3724172

Browse files
sethherrclaude
andcommitted
Name the impound claims impound_claim, not claim
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 6c216c4 commit 3724172

6 files changed

Lines changed: 36 additions & 36 deletions

File tree

app/components/registrations/show/current_alerts/claim_impound/component.html.erb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
data-controller="ui--collapse"
44
data-ui--collapse-param-value="contact_owner"
55
>
6-
<% if claim.present? %>
7-
<% if claim.unsubmitted? %>
8-
<%= form_with(model: claim, url: impound_claim_path(claim), builder: BikeIndexFormBuilder, data: {controller: "csrf-refresh"}) do |form| %>
6+
<% if impound_claim.present? %>
7+
<% if impound_claim.unsubmitted? %>
8+
<%= form_with(model: impound_claim, url: impound_claim_path(impound_claim), builder: BikeIndexFormBuilder, data: {controller: "csrf-refresh"}) do |form| %>
99
<%= render(UI::Forms::Group::Component.new(form_builder: form, attribute: :message, kind: :text_area,
10-
label_text: translation(".prove_its_yours", bike_type: claim.bike_type), html_options: {rows: 4})) %>
10+
label_text: translation(".prove_its_yours", bike_type: impound_claim.bike_type), html_options: {rows: 4})) %>
1111

1212
<%= render(UI::Button::Component.new(text: translation(".save_message"), color: :secondary, kind: :submit)) %>
1313
<% end %>
14-
<%= form_with(model: claim, url: impound_claim_path(claim), builder: BikeIndexFormBuilder, data: {controller: "csrf-refresh"}) do |form| %>
14+
<%= form_with(model: impound_claim, url: impound_claim_path(impound_claim), builder: BikeIndexFormBuilder, data: {controller: "csrf-refresh"}) do |form| %>
1515
<%= form.hidden_field :status, value: "submitting" %>
1616

1717
<div class="tw:mt-4">
@@ -25,22 +25,22 @@
2525
<% else %>
2626
<p>
2727
<%= translation(".claim_submitted") %>
28-
<%= render(UI::Time::Component.new(time: claim.submitted_at)) %>
28+
<%= render(UI::Time::Component.new(time: impound_claim.submitted_at)) %>
2929
</p>
30-
<% if claim.successful? %>
30+
<% if impound_claim.successful? %>
3131
<p class="tw:mt-2">
32-
<%= translation(".claim_was_status", status: claim.status_humanized) %>
32+
<%= translation(".claim_was_status", status: impound_claim.status_humanized) %>
3333
</p>
3434
<% end %>
3535
<% end %>
36-
<% elsif submitting_claim.present? %>
36+
<% elsif submitting_impound_claim.present? %>
3737
<p>
38-
<%= translation(".claim_with_this_bike_type", status: submitting_claim.status_humanized, bike_type: @bike.type) %>
38+
<%= translation(".claim_with_this_bike_type", status: submitting_impound_claim.status_humanized, bike_type: @bike.type) %>
3939
</p>
40-
<% if submitting_claim.bike_claimed.present? %>
40+
<% if submitting_impound_claim.bike_claimed.present? %>
4141
<p class="tw:mt-2">
42-
<%= link_to translation(".view_claimed_bike_type", kind: submitting_claim.kind, bike_type: submitting_claim.bike_claimed.type),
43-
registration_path(submitting_claim.bike_claimed), class: "twlink" %>
42+
<%= link_to translation(".view_claimed_bike_type", kind: submitting_impound_claim.kind, bike_type: submitting_impound_claim.bike_claimed.type),
43+
registration_path(submitting_impound_claim.bike_claimed), class: "twlink" %>
4444
</p>
4545
<% end %>
4646
<% elsif sign_in_redirect %>
@@ -53,7 +53,7 @@
5353
data: {"ui--collapse-target": "trigger", action: "ui--collapse#toggle"}
5454
)) %>
5555
<div data-ui--collapse-target="content" class="tw:hidden">
56-
<%= form_with(model: new_claim, url: impound_claims_path, builder: BikeIndexFormBuilder, data: {controller: "csrf-refresh"}) do |form| %>
56+
<%= form_with(model: new_impound_claim, url: impound_claims_path, builder: BikeIndexFormBuilder, data: {controller: "csrf-refresh"}) do |form| %>
5757
<%= form.hidden_field :impound_record_id, value: impound_record.id %>
5858

5959
<%= render(UI::Forms::Group::Component.new(form_builder: form, attribute: :stolen_record_id,

app/components/registrations/show/current_alerts/claim_impound/component.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def render?
2525
private
2626

2727
def heading
28-
translation((claim || submitting_claim) ? ".your_claim" : ".does_this_look_like_your_bike")
28+
translation((impound_claim || submitting_impound_claim) ? ".your_claim" : ".does_this_look_like_your_bike")
2929
end
3030

3131
def claim_button_text
@@ -37,29 +37,29 @@ def impound_record
3737
end
3838

3939
# The viewer's claim against this bike, once they've opened one
40-
def claim
41-
return @claim if defined?(@claim)
40+
def impound_claim
41+
return @impound_claim if defined?(@impound_claim)
4242

43-
@claim = viewer_claim(@bike.impound_claims_claimed)
43+
@impound_claim = viewer_impound_claim(@bike.impound_claims_claimed)
4444
end
4545

4646
# A claim the viewer opened with this bike - they're looking at the stolen bike
4747
# they submitted rather than the impounded one being claimed
48-
def submitting_claim
49-
return if claim.present?
50-
return @submitting_claim if defined?(@submitting_claim)
48+
def submitting_impound_claim
49+
return if impound_claim.present?
50+
return @submitting_impound_claim if defined?(@submitting_impound_claim)
5151

52-
@submitting_claim = viewer_claim(@bike.impound_claims_submitting)
52+
@submitting_impound_claim = viewer_impound_claim(@bike.impound_claims_submitting)
5353
end
5454

55-
def viewer_claim(claims)
55+
def viewer_impound_claim(impound_claims)
5656
return if @current_user.blank?
5757

58-
claims.where(user_id: @current_user.id).not_rejected.last
58+
impound_claims.where(user_id: @current_user.id).not_rejected.last
5959
end
6060

61-
def new_claim
62-
@new_claim ||= ImpoundClaim.new
61+
def new_impound_claim
62+
@new_impound_claim ||= ImpoundClaim.new
6363
end
6464

6565
# The viewer's stolen bikes they could claim this impound with

app/components/registrations/show/wrapper/claim_impound/preview_scenarios.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ def claim_page(current_user:, bike_id: nil)
2424
page(view: "consumer", bike_id: bike.id, current_user:, as_view: [:public, nil])
2525
end
2626

27-
def claim_page_for(claims)
28-
claim = claims.where.not(bike_claimed_id: nil).last
29-
return missing_notice("a matching impound claim") if claim.blank?
27+
def claim_page_for(impound_claims)
28+
impound_claim = impound_claims.where.not(bike_claimed_id: nil).last
29+
return missing_notice("a matching impound claim") if impound_claim.blank?
3030

31-
claim_page(bike_id: claim.bike_claimed_id, current_user: claim.user)
31+
claim_page(bike_id: impound_claim.bike_claimed_id, current_user: impound_claim.user)
3232
end
3333

3434
# An organization's impound record can't be claimed, so only unorganized ones

app/components/registrations/show/wrapper/claim_impound/submitted_with_this_bike_preview.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ class SubmittedWithThisBikePreview < ApplicationComponentPreview
1010
include PreviewScenarios
1111

1212
def default
13-
claim = ::ImpoundClaim.not_rejected.where.not(bike_submitting_id: nil).last
14-
return missing_notice("an impound claim") if claim.blank?
13+
impound_claim = ::ImpoundClaim.not_rejected.where.not(bike_submitting_id: nil).last
14+
return missing_notice("an impound claim") if impound_claim.blank?
1515

16-
claim_page(bike_id: claim.bike_submitting_id, current_user: claim.user)
16+
claim_page(bike_id: impound_claim.bike_submitting_id, current_user: impound_claim.user)
1717
end
1818
end
1919
end

app/components/registrations/show/wrapper/component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Wrapper
88
class Component < ApplicationComponent
99
# Digest of the markup inside the cache block — the cached_markup_digest spec
1010
# keeps it current, following what this tree renders out into UI:: and elsewhere
11-
MARKUP_DIGEST = "b58d5bf84caf"
11+
MARKUP_DIGEST = "40825799dc85"
1212

1313
def initialize(bike:, current_user:, view:, available_views:, bike_sticker: nil, current_alerts: {})
1414
@bike = bike

spec/components/registrations/show/wrapper/component_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def cache_key
2222
# The claim-impound card renders the viewer's own claim inside the cached body
2323
it "changes when the viewer edits their impound claim" do
2424
impound_record = FactoryBot.create(:impound_record, bike:)
25-
claim = FactoryBot.create(:impound_claim, impound_record:, user: current_user)
26-
expect { claim.update(message: "it has my sticker on it") }.to change { cache_key }
25+
impound_claim = FactoryBot.create(:impound_claim, impound_record:, user: current_user)
26+
expect { impound_claim.update(message: "it has my sticker on it") }.to change { cache_key }
2727
end
2828

2929
# The alert renders the prompt inside the cached body, token and all, so two

0 commit comments

Comments
 (0)