Sha256: b6a0a1f13afaade8d10c10e68a6dc4de127aec7a08e227693a9f700429d49372

Contents?: true

Size: 908 Bytes

Versions: 4

Compression:

Stored size: 908 Bytes

Contents

class UsersController < ApplicationController
  include WithUserParams

  before_action :authenticate!, except: :terms
  before_action :set_user!

  def show
    @messages = current_user.messages.to_a
    @watched_discussions = current_user.watched_discussions_in_organization
  end

  def update
    current_user.update_and_notify! user_params
    current_user.accept_profile_terms!
    redirect_to user_path, notice: I18n.t(:user_data_updated)
  end

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

  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

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

  private

  def validate_user_profile!
  end

  def set_user!
    @user = current_user
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mumuki-laboratory-7.12.3 app/controllers/users_controller.rb
mumuki-laboratory-8.0.0 app/controllers/users_controller.rb
mumuki-laboratory-7.12.1 app/controllers/users_controller.rb
mumuki-laboratory-7.12.0 app/controllers/users_controller.rb