From 6f8dee80e965dee2a30f8ed4dda4a4e614edb0cb Mon Sep 17 00:00:00 2001 From: maebeale Date: Thu, 18 Jun 2026 23:58:19 -0400 Subject: [PATCH] Confirm registrants with a "You're registered!" banner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a successful public registration the registrant landed on the ticket page with only a transient flash toast — no durable confirmation they were in. Carry a `registered` flag to the ticket page on the success redirect; show a green "You're registered!" banner above the ticket when arriving from a fresh registration or a successful Stripe `checkout=success` return, but not on plain return visits. Co-Authored-By: Claude Opus 4.8 --- .../events/public_registrations_controller.rb | 2 +- .../events/registrations_controller.rb | 2 ++ app/views/events/registrations/show.html.erb | 11 +++++++++++ spec/requests/events/registrations_spec.rb | 17 +++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/app/controllers/events/public_registrations_controller.rb b/app/controllers/events/public_registrations_controller.rb index 6bc6c141a..4de1e462d 100644 --- a/app/controllers/events/public_registrations_controller.rb +++ b/app/controllers/events/public_registrations_controller.rb @@ -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 diff --git a/app/controllers/events/registrations_controller.rb b/app/controllers/events/registrations_controller.rb index 1d62daecf..23019e064 100644 --- a/app/controllers/events/registrations_controller.rb +++ b/app/controllers/events/registrations_controller.rb @@ -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" end def invoice diff --git a/app/views/events/registrations/show.html.erb b/app/views/events/registrations/show.html.erb index 54f5ebf1c..404fb37a1 100644 --- a/app/views/events/registrations/show.html.erb +++ b/app/views/events/registrations/show.html.erb @@ -10,4 +10,15 @@ <% end %> +<% if @just_registered %> +
+
+ +
+

You're registered!

+

A confirmation has been emailed to you. Your ticket is below — save this page for your records.

+
+
+
+<% end %> <%= render "event_registrations/ticket", event_registration: @event_registration %> diff --git a/spec/requests/events/registrations_spec.rb b/spec/requests/events/registrations_spec.rb index b4530afe4..dcfcd3e66 100644 --- a/spec/requests/events/registrations_spec.rb +++ b/spec/requests/events/registrations_spec.rb @@ -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