app/controllers/decidim/conferences/conference_registrations_controller.rb in decidim-conferences-0.15.2 vs app/controllers/decidim/conferences/conference_registrations_controller.rb in decidim-conferences-0.16.0
- old
+ new
@@ -5,11 +5,11 @@
# Exposes the registration resource so users can join and leave conferences.
class ConferenceRegistrationsController < Decidim::Conferences::ApplicationController
def create
enforce_permission_to :join, :conference, conference: conference
- JoinConference.call(conference, current_user) do
+ JoinConference.call(conference, registration_type, current_user) do
on(:ok) do
flash[:notice] = I18n.t("conference_registrations.create.success", scope: "decidim.conferences")
redirect_after_path
end
@@ -21,11 +21,11 @@
end
def destroy
enforce_permission_to :leave, :conference, conference: conference
- LeaveConference.call(conference, current_user) do
+ LeaveConference.call(conference, registration_type, current_user) do
on(:ok) do
flash[:notice] = I18n.t("conference_registrations.destroy.success", scope: "decidim.conferences")
redirect_after_path
end
@@ -54,9 +54,13 @@
private
def conference
@conference ||= Conference.find_by(slug: params[:conference_slug])
+ end
+
+ def registration_type
+ conference.registration_types.find_by(id: params[:registration_type_id])
end
def redirect_after_path
referer = request.headers["Referer"]
return redirect_to(conference_path(conference)) if referer =~ /invitation_token/