Simplify reactions API controller
This commit is contained in:
parent
0223ea14fc
commit
b937083052
1 changed files with 1 additions and 13 deletions
|
@ -1,11 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Api::V1::Statuses::ReactionsController < Api::BaseController
|
class Api::V1::Statuses::ReactionsController < Api::V1::Statuses::BaseController
|
||||||
include Authorization
|
|
||||||
|
|
||||||
before_action -> { doorkeeper_authorize! :write, :'write:favourites' }
|
before_action -> { doorkeeper_authorize! :write, :'write:favourites' }
|
||||||
before_action :require_user!
|
before_action :require_user!
|
||||||
before_action :set_status
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
ReactService.new.call(current_account, @status, params[:id])
|
ReactService.new.call(current_account, @status, params[:id])
|
||||||
|
@ -19,13 +16,4 @@ class Api::V1::Statuses::ReactionsController < Api::BaseController
|
||||||
rescue Mastodon::NotPermittedError
|
rescue Mastodon::NotPermittedError
|
||||||
not_found
|
not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_status
|
|
||||||
@status = Status.find(params[:status_id])
|
|
||||||
authorize @status, :show?
|
|
||||||
rescue Mastodon::NotPermittedError
|
|
||||||
not_found
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue