scheduled_statuses_controller.rb 706 Bytes
Newer Older
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 33
# frozen_string_literal: true

class Settings::ScheduledStatusesController < Settings::BaseController
  layout 'admin'

  before_action :authenticate_user!
  before_action :set_account
  before_action :set_scheduled_statuses, only: :index
  before_action :set_scheduled_status, only: :destroy

  def index
    @scheduled_statuses
  end

  def destroy
    @scheduled_status.destroy!
    redirect_to settings_scheduled_statuses_path
  end

  private

  def set_account
    @account = current_user.account
  end

  def set_scheduled_statuses
    @scheduled_statuses = @account.scheduled_statuses
  end

  def set_scheduled_status
    @scheduled_status = @account.scheduled_statuses.find(params[:id])
  end
end