2020-03-09 17:57:10 +00:00
|
|
|
class Api::V1::Accounts::InboxesController < Api::BaseController
|
2019-08-14 09:48:44 +00:00
|
|
|
before_action :check_authorization
|
2020-02-19 09:10:03 +00:00
|
|
|
before_action :fetch_inbox, only: [:destroy, :update]
|
2019-08-14 09:48:44 +00:00
|
|
|
|
|
|
|
def index
|
|
|
|
@inboxes = policy_scope(current_account.inboxes)
|
|
|
|
end
|
|
|
|
|
2020-03-16 07:02:34 +00:00
|
|
|
def update
|
|
|
|
@inbox.update(inbox_update_params)
|
|
|
|
end
|
|
|
|
|
2019-08-14 09:48:44 +00:00
|
|
|
def destroy
|
|
|
|
@inbox.destroy
|
|
|
|
head :ok
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def fetch_inbox
|
|
|
|
@inbox = current_account.inboxes.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def check_authorization
|
|
|
|
authorize(Inbox)
|
|
|
|
end
|
2020-02-19 09:10:03 +00:00
|
|
|
|
|
|
|
def inbox_update_params
|
2020-04-07 04:49:19 +00:00
|
|
|
params.require(:inbox).permit(:enable_auto_assignment, :avatar)
|
2020-02-19 09:10:03 +00:00
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|