aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/settings_controller.rb
blob: b58c93cc62119fb87933dd55e1a0be5c68a1289f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class SettingsController < ApplicationController
  before_action :set_account

  def index
  end

  def update
    @account.update(notification_enabled: !!params[:notification_enabled])
    redirect_to action: "index"
  end

  def confirm_deactivation
  end

  def deactivate
    @account.deactivate!

    begin
      WorkerManager.update_account(@account)
    rescue Aclog::Exceptions::WorkerConnectionError
    end

    reset_session
  end

  private
  def set_account
    return redirect_to "/i/login?redirect_after_login=" + CGI.escape(url_for(only_path: true)) unless logged_in?

    @account = current_user.account
  end
end