Skip to content
Merged
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/views/event_registrations/link_organization.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<i class="fa-solid fa-file-lines"></i>
<% end %>
<div class="min-w-0">
<p class="text-base text-gray-800">Organization: <strong><%= entry[:org_name].presence || "β€”" %></strong><% if entry[:organization]&.city_state.present? %> <span class="text-sm text-gray-500">Β· <%= entry[:organization].city_state %></span><% end %></p>
<p class="text-base text-gray-800">Organization: <strong><%= entry[:org_name].presence || "β€”" %></strong><% if entry[:organization]&.city_state.present? %> <span class="text-sm text-gray-500">Β· <%= entry[:organization].city_state %></span><% 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? %> <span class="ml-1 inline-flex items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2.5 py-0.5 text-xs font-medium text-amber-700" title="The registrant submitted this organization, but none is linked to the registration yet."><i class="fa-solid fa-circle-exclamation text-[0.65rem]"></i>Pending</span><% end %></p>

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: Same amber "Pending" badge as the roster, shown only while @linked_organizations.none?, so opening the editor explains why the registrant was flagged β€” and it disappears the moment something is linked.

<p class="text-base text-gray-800">Position / title: <strong><%= entry[:position].presence || "β€”" %></strong></p>
</div>
</li>
Expand Down
8 changes: 4 additions & 4 deletions app/views/events/_registrants_results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@
<td class="px-4 py-2 text-sm text-gray-800">
<% 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? %>

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: The chip now keys off linked_orgs.none? rather than name-matching: once an admin has linked any org they've resolved it, so a different submitted name is no longer noise.

<% 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" %>
<div class="flex flex-wrap gap-1.5">
Expand Down
18 changes: 18 additions & 0 deletions spec/requests/event_registrations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions spec/requests/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down