Test: API呼び出しによってスタンプをつけるテスト (#139)

* Test: API呼び出しによってスタンプをつけるテスト

* Fix: スタンプ削除APIで`emoji`パラメータを指定していないときに投稿が自由閲覧できる問題

* Test: さっきの問題のテストを追加
This commit is contained in:
KMY(雪あすか) 2023-10-18 10:34:53 +09:00 committed by GitHub
parent d62a135806
commit b73eb1b847
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 285 additions and 4 deletions

View file

@ -3,9 +3,9 @@
class Api::V1::Statuses::EmojiReactionsController < Api::BaseController
include Authorization
before_action -> { doorkeeper_authorize! :write, :'write:emoji_reactions' }
before_action -> { doorkeeper_authorize! :write, :'write:favourites' }
before_action :require_user!
before_action :set_status, only: %i(create update destroy)
before_action :set_status, only: %i(create update)
before_action :set_status_without_authorize, only: [:destroy]
def create
@ -28,6 +28,8 @@ class Api::V1::Statuses::EmojiReactionsController < Api::BaseController
authorize @status, :show? if emoji_reaction.nil?
UnEmojiReactService.new.call(current_account.id, @status.id, emoji_reaction) if emoji_reaction.present?
else
authorize @status, :show?
end
render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(