Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/events/public_registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def create
checkout_session = create_stripe_checkout_session(registration, result.form_submission)
redirect_to checkout_session.url, allow_other_host: true, status: :see_other
else
redirect_to registration_ticket_path(registration.slug),
redirect_to registration_ticket_path(registration.slug, registered: true),
notice: "You have been successfully registered!"
end
else
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/events/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def show
when "cancelled"
flash.now[:alert] = "Payment was cancelled. You are registered for this event but payment may still be due."
end

@just_registered = params[:registered].present? || params[:checkout] == "success"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Banner fires for a fresh registration (?registered=true) and a successful Stripe return (checkout=success), but not on plain ticket re-visits.

end

def invoice
Expand Down
11 changes: 11 additions & 0 deletions app/views/events/registrations/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,15 @@
<% end %>
</div>
</div>
<% if @just_registered %>
<div class="max-w-2xl mx-auto px-4 pt-3">
<div class="flex items-center gap-4 rounded-2xl border border-green-200 bg-green-50 px-5 py-4 text-green-800 shadow-sm">
<i class="fa-solid fa-circle-check text-3xl text-green-600"></i>
<div>
<p class="text-xl font-bold leading-tight">You're registered!</p>
<p class="text-sm text-green-700">A confirmation has been emailed to you. Your ticket is below — save this page for your records.</p>
</div>
</div>
</div>
<% end %>
<%= render "event_registrations/ticket", event_registration: @event_registration %>
17 changes: 17 additions & 0 deletions spec/requests/events/registrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@
expect(response).to have_http_status(:not_found)
end
end

context "just-registered banner" do
it "shows a 'You're registered!' banner when arriving from a fresh registration" do
get registration_ticket_path(registration.slug, registered: true)
expect(response.body).to include("You're registered!")
end

it "shows the banner after a successful Stripe checkout" do
get registration_ticket_path(registration.slug, checkout: "success")
expect(response.body).to include("You're registered!")
end

it "omits the banner on a plain ticket view" do
get registration_ticket_path(registration.slug)
expect(response.body).not_to include("You're registered!")
end
end
end

describe "GET /registration/:slug/invoice" do
Expand Down