Remove unsafed api emoji_reactions slim
This commit is contained in:
parent
e84eb3fc81
commit
dd51fae42f
5 changed files with 0 additions and 95 deletions
|
@ -1,31 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Api::V1::Statuses::EmojiReactionedByAccountsSlimController < Api::BaseController
|
|
||||||
include Authorization
|
|
||||||
|
|
||||||
before_action -> { authorize_if_got_token! :read, :'read:accounts' }
|
|
||||||
before_action :set_status
|
|
||||||
|
|
||||||
def index
|
|
||||||
@accounts = load_emoji_reactions
|
|
||||||
|
|
||||||
# TODO: for serialize hash object
|
|
||||||
# render json: @accounts, each_serializer: REST::EmojiReactedBySlimSerializer
|
|
||||||
|
|
||||||
# Hide WIP api for hide account secret
|
|
||||||
not_found
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def load_emoji_reactions
|
|
||||||
@status.generate_emoji_reactions_grouped_by_account
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_status
|
|
||||||
@status = Status.find(params[:status_id])
|
|
||||||
authorize @status, :show?
|
|
||||||
rescue Mastodon::NotPermittedError
|
|
||||||
not_found
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,16 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class StatusEmojiReactionsGroupedByAccountObject
|
|
||||||
def initialize(account, emoji_reactions)
|
|
||||||
@account = account
|
|
||||||
@emoji_reactions = emoji_reactions
|
|
||||||
end
|
|
||||||
|
|
||||||
def read_attribute_for_serialization(_)
|
|
||||||
REST::EmojiReactedBySlimSerializer
|
|
||||||
end
|
|
||||||
|
|
||||||
def model_name
|
|
||||||
'EmojiReaction'
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,27 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class REST::EmojiReactedBySlimReactionSerializer < ActiveModel::Serializer
|
|
||||||
include RoutingHelper
|
|
||||||
|
|
||||||
attributes :name
|
|
||||||
|
|
||||||
attribute :url, if: :custom_emoji?
|
|
||||||
attribute :static_url, if: :custom_emoji?
|
|
||||||
attribute :domain, if: :custom_emoji?
|
|
||||||
|
|
||||||
def url
|
|
||||||
full_asset_url(object.custom_emoji.image.url)
|
|
||||||
end
|
|
||||||
|
|
||||||
def static_url
|
|
||||||
full_asset_url(object.custom_emoji.image.url(:static))
|
|
||||||
end
|
|
||||||
|
|
||||||
def domain
|
|
||||||
object.custom_emoji.domain
|
|
||||||
end
|
|
||||||
|
|
||||||
def custom_emoji?
|
|
||||||
object.custom_emoji.present?
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,20 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class REST::EmojiReactedBySlimSerializer < ActiveModel::Serializer
|
|
||||||
belongs_to :account, serializer: REST::AccountSerializer
|
|
||||||
has_many :emoji_reactions, serializer: REST::EmojiReactedBySlimReactionSerializer
|
|
||||||
|
|
||||||
def attributes
|
|
||||||
{ account => emoji_reactions }
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def account
|
|
||||||
object.first
|
|
||||||
end
|
|
||||||
|
|
||||||
def emoji_reactions
|
|
||||||
object.last
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -11,7 +11,6 @@ namespace :api, format: false do
|
||||||
resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
|
resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
|
||||||
resources :favourited_by, controller: :favourited_by_accounts, only: :index
|
resources :favourited_by, controller: :favourited_by_accounts, only: :index
|
||||||
resources :emoji_reactioned_by, controller: :emoji_reactioned_by_accounts, only: :index
|
resources :emoji_reactioned_by, controller: :emoji_reactioned_by_accounts, only: :index
|
||||||
resources :emoji_reactioned_by_slim, controller: :emoji_reactioned_by_accounts_slim, only: :index
|
|
||||||
resources :referred_by, controller: :referred_by_statuses, only: :index
|
resources :referred_by, controller: :referred_by_statuses, only: :index
|
||||||
resources :bookmark_categories, only: :index
|
resources :bookmark_categories, only: :index
|
||||||
resource :reblog, only: :create
|
resource :reblog, only: :create
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue