Class: UsersController

Inherits:
ApplicationController show all
Includes:
WithUserParams
Defined in:
app/controllers/users_controller.rb

Instance Method Summary collapse

Methods included from WithUserParams

#user_name_params, #user_params

Methods inherited from ApplicationController

#current_immersive_organizations, #current_immersive_path, #current_immersive_path_for, #current_workspace, #immersive_context_wrong?, #login_button, #redirect_to_proper_context!, #redirect_to_usage, #should_choose_organization?, #validate_accessible!, #validate_active_organization!

Methods included from Mumuki::Laboratory::Controllers::ActionRedirector

#redirect_after!, #save_location_before!

Methods included from Mumuki::Laboratory::Controllers::IncognitoMode

#current_incognito_user?, #current_logged_user?, #current_user, #current_user?, #incognito_mode_enabled?

Methods included from Mumuki::Laboratory::Controllers::EmbeddedMode

#embedded_mode?, #enable_embedded_rendering, #standalone_mode?

Methods included from Mumuki::Laboratory::Controllers::DynamicErrors

#bad_record, #blocked_forum, #disabled, #disabled_organization, #forbidden, #gone, #internal_server_error, #not_found, #render_error, #unauthorized, #unprepared_organization

Methods included from Mumuki::Laboratory::Controllers::Notifications

#has_notifications?, #notifications, #notifications_count

Methods included from Mumuki::Laboratory::Controllers::Disabling

#ensure_user_enabled!

Methods included from Mumuki::Laboratory::Controllers::Authorization

#authorization_slug, #authorize_if_private!

Methods included from Mumuki::Laboratory::Controllers::CurrentOrganization

#organization_name, #set_current_organization!, #visit_organization!

Instance Method Details

#accept_profile_termsObject



15
16
17
18
19
# File 'app/controllers/users_controller.rb', line 15

def accept_profile_terms
  current_user.accept_profile_terms!
  flash.notice = I18n.t(:terms_accepted)
  redirect_after! :terms_acceptance, fallback_location: root_path
end

#activityObject



33
34
35
# File 'app/controllers/users_controller.rb', line 33

def activity
  @activity = UserStats.stats_for(current_user).activity date_range_params
end

#certificatesObject



37
38
39
# File 'app/controllers/users_controller.rb', line 37

def certificates
  @certificates ||= current_user.certificates_in_organization
end

#discussionsObject



29
30
31
# File 'app/controllers/users_controller.rb', line 29

def discussions
  @watched_discussions = current_user.watched_discussions_in_organization
end

#messagesObject



25
26
27
# File 'app/controllers/users_controller.rb', line 25

def messages
  @messages ||= current_user.messages_in_organization
end

#permissible_paramsObject



48
49
50
# File 'app/controllers/users_controller.rb', line 48

def permissible_params
  super << [:avatar_id, :avatar_type]
end

#termsObject



21
22
23
# File 'app/controllers/users_controller.rb', line 21

def terms
  @profile_terms ||= Term.profile_terms_for(current_user)
end

#unsubscribeObject



41
42
43
44
45
46
# File 'app/controllers/users_controller.rb', line 41

def unsubscribe
  user_id = User.unsubscription_verifier.verify(params[:id])
  User.find(user_id).unsubscribe_from_reminders!

  redirect_to root_path, notice: t(:unsubscribed_successfully)
end

#updateObject



8
9
10
11
12
13
# File 'app/controllers/users_controller.rb', line 8

def update
  current_user.update_and_notify! user_params
  current_user.accept_profile_terms!
  flash.notice = I18n.t(:user_data_updated)
  redirect_after! :profile_completion, fallback_location: user_path
end