Sha256: 540dc61c20491813bc058e78dedbc5e8438739220bdcc7d07257f535a6d31ac8

Contents?: true

Size: 758 Bytes

Versions: 10

Compression:

Stored size: 758 Bytes

Contents

class UsersController < ApplicationController
  before_action :authenticate!
  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
    redirect_to root_path, notice: I18n.t(:user_data_updated)
  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

  private

  def validate_user_profile!
  end

  def user_params
    params.require(:user).permit(:first_name, :last_name)
  end

  def set_user!
    @user = current_user
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mumuki-laboratory-6.7.7 app/controllers/users_controller.rb
mumuki-laboratory-6.7.6 app/controllers/users_controller.rb
mumuki-laboratory-6.7.5 app/controllers/users_controller.rb
mumuki-laboratory-6.7.4 app/controllers/users_controller.rb
mumuki-laboratory-6.7.3 app/controllers/users_controller.rb
mumuki-laboratory-6.7.2 app/controllers/users_controller.rb
mumuki-laboratory-6.7.1 app/controllers/users_controller.rb
mumuki-laboratory-6.7.0 app/controllers/users_controller.rb
mumuki-laboratory-6.6.1 app/controllers/users_controller.rb
mumuki-laboratory-6.6.0 app/controllers/users_controller.rb