From ffe772d34a5df3187a8d65944aa344df80081125 Mon Sep 17 00:00:00 2001 From: Justin Miller <16829344+jmilljr24@users.noreply.github.com> Date: Fri, 4 Sep 2026 13:00:37 -0400 Subject: [PATCH 1/2] remove default due to bug --- app/helpers/application_helper.rb | 9 --------- app/views/events/_form.html.erb | 7 ++----- spec/helpers/application_helper_spec.rb | 20 -------------------- spec/views/events/_form.html.erb_spec.rb | 22 ++++++++++++++++++++++ 4 files changed, 24 insertions(+), 34 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2f31bb4370..16a4c25270 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -262,15 +262,6 @@ def event_registration_close_time_label(event) "at #{time} #{local.strftime("%Z")}" end - # Default registration close datetime suggested on the event form: 9am on the - # Monday before the event's start date. New events without a start date yet - # fall back to two days out at 9am. - def event_registration_close_default(event) - start = event&.start_date - base = start ? (start.in_time_zone(Time.zone) - 1.day).beginning_of_week(:monday) : 2.days.from_now - base.change(hour: 9, min: 0) - end - # The accent strip partial for the current page, chosen from its page_bg_class # policy marker (set with content_for at the top of the view, so it is captured # before the shell renders): diff --git a/app/views/events/_form.html.erb b/app/views/events/_form.html.erb index edd9b39ba9..bf96aaae2e 100644 --- a/app/views/events/_form.html.erb +++ b/app/views/events/_form.html.erb @@ -115,21 +115,18 @@

Registration closed

- <% rc_default = @event.registration_close_date || event_registration_close_default(@event) %>
<%= f.text_field :registration_close_date_date, type: "date", - class: "w-full rounded border-gray-300 shadow-sm px-3 py-2 focus:ring-blue-500 focus:border-blue-500", - value: rc_default.strftime("%Y-%m-%d") %> + class: "w-full rounded border-gray-300 shadow-sm px-3 py-2 focus:ring-blue-500 focus:border-blue-500" %>
<%= f.text_field :registration_close_date_time, type: "time", - class: "w-full rounded border-gray-300 shadow-sm px-3 py-2 focus:ring-blue-500 focus:border-blue-500", - value: rc_default.strftime("%H:%M") %>
+ class: "w-full rounded border-gray-300 shadow-sm px-3 py-2 focus:ring-blue-500 focus:border-blue-500" %>
<% if f.object.errors[:registration_close_date].any? %>

Registration close date <%= f.object.errors[:registration_close_date].join(", ") %>

diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 15b7eb23e7..88e590c027 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -578,26 +578,6 @@ def strip_for(marker) end end - describe "#event_registration_close_default" do - it "is 9am on the Monday of the start date's week" do - event = build(:event, start_date: Time.zone.local(2026, 7, 22, 13, 0)) # Wednesday - expect(helper.event_registration_close_default(event)).to eq(Time.zone.local(2026, 7, 20, 9, 0)) - end - - it "is the prior Monday at 9am when the event starts on a Monday" do - event = build(:event, start_date: Time.zone.local(2026, 7, 20, 9, 0)) # Monday - expect(helper.event_registration_close_default(event)).to eq(Time.zone.local(2026, 7, 13, 9, 0)) - end - - it "falls back to two days out at 9am when there is no start date" do - event = build(:event, start_date: nil) - default = helper.event_registration_close_default(event) - expect(default.hour).to eq(9) - expect(default.min).to eq(0) - expect(default.to_date).to eq(2.days.from_now.to_date) - end - end - describe "#routable_path for a form submission" do it "links to the registration details page when the submitter is registered" do event = create(:event) diff --git a/spec/views/events/_form.html.erb_spec.rb b/spec/views/events/_form.html.erb_spec.rb index cc8946ba05..10b07ef4c1 100644 --- a/spec/views/events/_form.html.erb_spec.rb +++ b/spec/views/events/_form.html.erb_spec.rb @@ -95,6 +95,28 @@ end end + context "when the registration close date is not set" do + let(:event) { create(:event, registration_close_date: nil) } + + it "leaves the registration close fields blank instead of repopulating a default" do + render + + expect(rendered).to have_selector("input[name='event[registration_close_date_date]']:not([value])") + expect(rendered).to have_selector("input[name='event[registration_close_date_time]']:not([value])") + end + end + + context "when the event is new" do + let(:event) { Event.new(title: "New Event") } + + it "leaves the registration close fields blank for new events too" do + render + + expect(rendered).to have_selector("input[name='event[registration_close_date_date]']:not([value])") + expect(rendered).to have_selector("input[name='event[registration_close_date_time]']:not([value])") + end + end + context "when published is false" do let(:event) { create(:event, published: false) } From ad478b096db87ca87fd89fae7d4271fc96edc7c9 Mon Sep 17 00:00:00 2001 From: Justin Miller <16829344+jmilljr24@users.noreply.github.com> Date: Fri, 4 Sep 2026 13:11:42 -0400 Subject: [PATCH 2/2] clean up --- spec/views/events/_form.html.erb_spec.rb | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/spec/views/events/_form.html.erb_spec.rb b/spec/views/events/_form.html.erb_spec.rb index 10b07ef4c1..cc8946ba05 100644 --- a/spec/views/events/_form.html.erb_spec.rb +++ b/spec/views/events/_form.html.erb_spec.rb @@ -95,28 +95,6 @@ end end - context "when the registration close date is not set" do - let(:event) { create(:event, registration_close_date: nil) } - - it "leaves the registration close fields blank instead of repopulating a default" do - render - - expect(rendered).to have_selector("input[name='event[registration_close_date_date]']:not([value])") - expect(rendered).to have_selector("input[name='event[registration_close_date_time]']:not([value])") - end - end - - context "when the event is new" do - let(:event) { Event.new(title: "New Event") } - - it "leaves the registration close fields blank for new events too" do - render - - expect(rendered).to have_selector("input[name='event[registration_close_date_date]']:not([value])") - expect(rendered).to have_selector("input[name='event[registration_close_date_time]']:not([value])") - end - end - context "when published is false" do let(:event) { create(:event, published: false) }