More sane branching in confirm action of proposal controller

This commit is contained in:
Aditya Prakash 2016-03-31 15:31:54 +05:30
parent f4678e5415
commit c35270ad31

View file

@ -110,12 +110,7 @@ class ProposalController < ApplicationController
return return
end end
unless @event.save if @event.save
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title),
error: "Could not confirm proposal: #{@event.errors.full_messages.join(', ')}"
return
end
if @conference.user_registered?(current_user) if @conference.user_registered?(current_user)
redirect_to conference_program_proposal_index_path(@conference.short_title), redirect_to conference_program_proposal_index_path(@conference.short_title),
notice: 'The proposal was confirmed.' notice: 'The proposal was confirmed.'
@ -123,6 +118,10 @@ class ProposalController < ApplicationController
redirect_to new_conference_conference_registrations_path(conference_id: @conference.short_title), redirect_to new_conference_conference_registrations_path(conference_id: @conference.short_title),
alert: 'The proposal was confirmed. Please register to attend the conference.' alert: 'The proposal was confirmed. Please register to attend the conference.'
end end
else
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title),
error: "Could not confirm proposal: #{@event.errors.full_messages.join(', ')}"
end
end end
def restart def restart