app/commands/decidim/meetings/join_meeting.rb in decidim-meetings-0.26.2 vs app/commands/decidim/meetings/join_meeting.rb in decidim-meetings-0.26.3
- old
+ new
@@ -23,11 +23,12 @@
def call
meeting.with_lock do
return broadcast(:invalid) unless can_join_meeting?
return broadcast(:invalid_form) unless registration_form.valid?
- answer_questionnaire
+ return broadcast(:invalid) if answer_questionnaire == :invalid
+
create_registration
accept_invitation
send_email_confirmation
send_notification_confirmation
notify_admin_over_percentage
@@ -46,10 +47,18 @@
end
def answer_questionnaire
return unless questionnaire?
- Decidim::Forms::AnswerQuestionnaire.call(registration_form, user, meeting.questionnaire)
+ Decidim::Forms::AnswerQuestionnaire.call(registration_form, user, meeting.questionnaire) do
+ on(:ok) do
+ return :valid
+ end
+
+ on(:invalid) do
+ return :invalid
+ end
+ end
end
def create_registration
@registration = Decidim::Meetings::Registration.create!(
meeting: meeting,