From f0cc47ebbc4aee9d76a16ad6a7a7042866c9b80b Mon Sep 17 00:00:00 2001 From: maebeale Date: Sat, 7 Mar 2026 06:03:58 -0500 Subject: [PATCH] Add submitter confirmation email to WorkshopIdea creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WorkshopIdea was the only submission model missing a submitter notification — StoryIdea, WorkshopVariationIdea, WorkshopLog, and EventRegistration already sent both. This aligns the pattern. Co-Authored-By: Claude Opus 4.6 --- app/controllers/workshop_ideas_controller.rb | 6 ++++++ spec/requests/workshop_ideas_spec.rb | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/app/controllers/workshop_ideas_controller.rb b/app/controllers/workshop_ideas_controller.rb index 681e2fd0a..cbac3a123 100644 --- a/app/controllers/workshop_ideas_controller.rb +++ b/app/controllers/workshop_ideas_controller.rb @@ -26,6 +26,12 @@ def create authorize! @workshop_idea if @workshop_idea.save + NotificationServices::CreateNotification.call( + noticeable: @workshop_idea, + kind: :idea_submitted, + recipient_role: :person, + recipient_email: @workshop_idea.created_by.email, + notification_type: 0) NotificationServices::CreateNotification.call( noticeable: @workshop_idea, kind: :idea_submitted_fyi, diff --git a/spec/requests/workshop_ideas_spec.rb b/spec/requests/workshop_ideas_spec.rb index 1bd7af479..9d2fe45e4 100644 --- a/spec/requests/workshop_ideas_spec.rb +++ b/spec/requests/workshop_ideas_spec.rb @@ -79,6 +79,23 @@ expect(response).to redirect_to(workshop_idea_path(WorkshopIdea.last)) end + it "sends admin and submitter notifications" do + expect(NotificationServices::CreateNotification).to receive(:call).with( + hash_including( + kind: :idea_submitted, + recipient_role: :person + ) + ) + expect(NotificationServices::CreateNotification).to receive(:call).with( + hash_including( + kind: :idea_submitted_fyi, + recipient_role: :admin + ) + ) + + post workshop_ideas_path, params: { workshop_idea: valid_attributes } + end + it "handles RecordNotUnique gracefully" do allow_any_instance_of(WorkshopIdea).to receive(:save).and_raise( ActiveRecord::RecordNotUnique.new("Duplicate entry")