1
0

Simplify reactions API controller

This commit is contained in:
Essem 2024-01-23 22:59:42 -06:00
parent 229fafe681
commit df6d11d630
No known key found for this signature in database
GPG Key ID: 7D497397CC3A2A8C

View File

@ -1,11 +1,8 @@
# frozen_string_literal: true
class Api::V1::Statuses::ReactionsController < Api::BaseController
include Authorization
class Api::V1::Statuses::ReactionsController < Api::V1::Statuses::BaseController
before_action -> { doorkeeper_authorize! :write, :'write:favourites' }
before_action :require_user!
before_action :set_status
def create
ReactService.new.call(current_account, @status, params[:id])
@ -19,13 +16,4 @@ class Api::V1::Statuses::ReactionsController < Api::BaseController
rescue Mastodon::NotPermittedError
not_found
end
private
def set_status
@status = Status.find(params[:status_id])
authorize @status, :show?
rescue Mastodon::NotPermittedError
not_found
end
end