diff --git a/app/models/competition.rb b/app/models/competition.rb index fd8c954444..ba71484a1b 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -612,7 +612,7 @@ def info_for(user) end def user_can_pre_register?(user) - delegates.include?(user) || trainee_delegates.include?(user) || organizers.include?(user) + (delegates.include?(user) || trainee_delegates.include?(user) || organizers.include?(user)) && self.confirmed_or_visible? end attr_accessor :being_cloned_from_id diff --git a/app/views/competitions/_competition_form.html.erb b/app/views/competitions/_competition_form.html.erb index d9e3deb8b7..80a8dc1466 100644 --- a/app/views/competitions/_competition_form.html.erb +++ b/app/views/competitions/_competition_form.html.erb @@ -4,6 +4,7 @@ competition: @competition.to_form_data, usesV2Registrations: @competition.uses_v2_registrations, canChangeRegistrationSystem: @competition.can_change_registration_system?, + hasAnyRegistrations: @competition.any_registrations?, storedEvents: @competition.events, isAdminView: @competition_admin_view, isPersisted: @competition.persisted?, diff --git a/app/webpacker/components/CompetitionForm/FormSections/NameDetails.js b/app/webpacker/components/CompetitionForm/FormSections/NameDetails.js index 044ce07651..d2f4785c0a 100644 --- a/app/webpacker/components/CompetitionForm/FormSections/NameDetails.js +++ b/app/webpacker/components/CompetitionForm/FormSections/NameDetails.js @@ -6,7 +6,7 @@ import { competitionMaxShortNameLength } from '../../../lib/wca-data.js.erb'; import { useFormObject } from '../../wca/FormBuilder/provider/FormObjectProvider'; export default function NameDetails() { - const { isPersisted, isAdminView } = useStore(); + const { hasAnyRegistrations, isPersisted, isAdminView } = useStore(); const { name } = useFormObject(); @@ -15,7 +15,7 @@ export default function NameDetails() { return ( <> - {isPersisted && } + {isPersisted && } {isPersisted && ( Monolith V2 migration + # Can safely be removed once the wca-registrations microservice is gone. (GB 2024-10-15) + allow(Microservices::Registrations).to receive(:competitor_count_by_competition).and_return(0) + end + context "when signed in as admin" do let!(:admin) { FactoryBot.create :admin } before :each do