Move status serializer chooser to private method (#29030)
This commit is contained in:
parent
cf42eba0f9
commit
93a5b3f9df
|
@ -71,7 +71,7 @@ class Api::V1::StatusesController < Api::BaseController
|
||||||
with_rate_limit: true
|
with_rate_limit: true
|
||||||
)
|
)
|
||||||
|
|
||||||
render json: @status, serializer: @status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
|
render json: @status, serializer: serializer_for_status
|
||||||
rescue PostStatusService::UnexpectedMentionsError => e
|
rescue PostStatusService::UnexpectedMentionsError => e
|
||||||
unexpected_accounts = ActiveModel::Serializer::CollectionSerializer.new(
|
unexpected_accounts = ActiveModel::Serializer::CollectionSerializer.new(
|
||||||
e.accounts,
|
e.accounts,
|
||||||
|
@ -155,6 +155,10 @@ class Api::V1::StatusesController < Api::BaseController
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def serializer_for_status
|
||||||
|
@status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer
|
||||||
|
end
|
||||||
|
|
||||||
def pagination_params(core_params)
|
def pagination_params(core_params)
|
||||||
params.slice(:limit).permit(:limit).merge(core_params)
|
params.slice(:limit).permit(:limit).merge(core_params)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue