Add support for a new parameter "client_type", so that API clients may specify whether the API semantics should tend towards defaults that are suitable to an editor or a reader type application.

This commit is contained in:
Daniel Jalkut 2023-05-15 11:28:12 -04:00
parent b84bc2de5d
commit ece32664ff

View file

@ -9,7 +9,8 @@ class Api::V1::Accounts::StatusesController < Api::BaseController
def index
cache_if_unauthenticated!
@statuses = load_statuses
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id)
return_source = params[:client_type] == 'editor'
render json: @statuses, each_serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new(@statuses, current_user&.account_id), source_requested: return_source
end
private