diff --git a/app/views/event_registrations/link_organization.html.erb b/app/views/event_registrations/link_organization.html.erb
index 53520ca02..eabdecd84 100644
--- a/app/views/event_registrations/link_organization.html.erb
+++ b/app/views/event_registrations/link_organization.html.erb
@@ -54,7 +54,7 @@
<% end %>
-
Organization: <%= entry[:org_name].presence || "—" %><% if entry[:organization]&.city_state.present? %> · <%= entry[:organization].city_state %><% end %>
+
Organization: <%= entry[:org_name].presence || "—" %><% if entry[:organization]&.city_state.present? %> · <%= entry[:organization].city_state %><% end %><%# Mirror the roster's amber "Pending" chip so it's clear why this registrant was flagged — shown only while nothing is linked. %><% if entry[:org_name].present? && @linked_organizations.none? %> Pending<% end %>
Position / title: <%= entry[:position].presence || "—" %>
diff --git a/app/views/events/_registrants_results.html.erb b/app/views/events/_registrants_results.html.erb
index 00cb99afb..5e458c969 100644
--- a/app/views/events/_registrants_results.html.erb
+++ b/app/views/events/_registrants_results.html.erb
@@ -118,10 +118,10 @@
<% linked_orgs = registration.organizations %>
<% submitted_org_name = submitted_org_names[registration.registrant_id].to_s.strip %>
- <% linked_org_names = linked_orgs.map { |org| org.name.to_s.strip.downcase } %>
- <%# A submitted name not represented among the linked orgs still needs admin
- attention; a name matching a linked org is already resolved. %>
- <% needs_linking = submitted_org_name.present? && linked_org_names.exclude?(submitted_org_name.downcase) %>
+ <%# A submitted org name needs admin attention only while nothing is linked
+ yet; once an admin links any org they've made the call, so a non-matching
+ submitted name is no longer treated as pending. %>
+ <% needs_linking = submitted_org_name.present? && linked_orgs.none? %>
<% editor_path = link_organization_event_registration_path(registration, return_to: "registrants") %>
<% pill_classes = "inline-flex items-center gap-1.5 rounded-full text-xs font-medium border px-3 py-0.5 transition hover:opacity-80 hover:shadow-sm" %>
diff --git a/spec/requests/event_registrations_spec.rb b/spec/requests/event_registrations_spec.rb
index 565821923..f1d736146 100644
--- a/spec/requests/event_registrations_spec.rb
+++ b/spec/requests/event_registrations_spec.rb
@@ -574,6 +574,24 @@ def details_open?(body, heading)
expect(response.body).not_to include("No registration form was submitted")
end
+ it "shows a 'Pending' badge next to the submitted org when nothing is linked" do
+ existing_registration.event_registration_organizations.destroy_all
+ submit_form(org_name: "Riverside Healing Arts Collective")
+
+ get link_organization_event_registration_path(existing_registration)
+
+ expect(response.body).to include("Riverside Healing Arts Collective")
+ expect(response.body).to include(">Pending<")
+ end
+
+ it "does not show the 'Pending' badge once an organization is linked" do
+ submit_form(org_name: "Riverside Healing Arts Collective")
+
+ get link_organization_event_registration_path(existing_registration)
+
+ expect(response.body).not_to include(">Pending<")
+ end
+
it "shows 'Create org & link' when the submitted org has no existing match" do
submit_form(org_name: "Brand New Unlisted Org")
diff --git a/spec/requests/events_spec.rb b/spec/requests/events_spec.rb
index 1420b0dff..cf0f8e177 100644
--- a/spec/requests/events_spec.rb
+++ b/spec/requests/events_spec.rb
@@ -591,14 +591,14 @@ def submit_agency_name(name)
expect(response.body).not_to include(">Pending<")
end
- it "shows the linked org AND a 'Pending' chip when the submitted name is not among the linked orgs" do
+ it "does not show a 'Pending' chip when an org is linked, even if the submitted name differs" do
create(:event_registration_organization, event_registration: registration, organization: organization)
submit_agency_name("A Different Unlisted Agency")
get registrants_event_path(event)
expect(response.body).to include(organization.name)
- expect(response.body).to include(">Pending<")
+ expect(response.body).not_to include(">Pending<")
end
it "does not show 'Pending' when the submitted name matches a linked org" do
|