Sha256: cca72b6e87a3c3592b63c334c79d5703462d9a401c750076f3d451affa4e17b0

Contents?: true

Size: 882 Bytes

Versions: 13

Compression:

Stored size: 882 Bytes

Contents

class InvitationsController < ApplicationController
  include WithUserParams

  before_action :authenticate!
  before_action :set_invitation!
  before_action :set_user!

  skip_before_action :validate_user_profile!
  skip_before_action :authorize_if_private!

  def show
    redirect_to_organization! if current_user.student_of? @invitation.course
  end

  def join
    current_user.accept_invitation! @invitation
    current_user.update! user_params
    current_user.notify!
    redirect_to_organization!
  end

  private

  def redirect_to_organization!
    redirect_to Mumukit::Platform.laboratory.organic_url(@organization)
  end

  def permissible_params
    super + [:email, :name]
  end

  def set_invitation!
    @invitation = Invitation.locate!(params[:code]).unexpired
    @organization = @invitation.organization
  end

  def set_user!
    @user = current_user
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mumuki-laboratory-7.5.2 app/controllers/invitations_controller.rb
mumuki-laboratory-7.5.1 app/controllers/invitations_controller.rb
mumuki-laboratory-7.5.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.4.2 app/controllers/invitations_controller.rb
mumuki-laboratory-7.4.1 app/controllers/invitations_controller.rb
mumuki-laboratory-7.4.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.3.1 app/controllers/invitations_controller.rb
mumuki-laboratory-7.3.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.2.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.1.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.0.12 app/controllers/invitations_controller.rb
mumuki-laboratory-7.0.11 app/controllers/invitations_controller.rb
mumuki-laboratory-7.0.10 app/controllers/invitations_controller.rb