Change /api/v1/statuses/:id/history to always return at least one item (#25510)
This commit is contained in:
parent
07c2330a05
commit
7d6a3b5527
@ -7,16 +7,11 @@ class Api::V1::Statuses::HistoriesController < Api::BaseController
|
|||||||
before_action :set_status
|
before_action :set_status
|
||||||
|
|
||||||
def show
|
def show
|
||||||
cache_if_unauthenticated!
|
render json: @status.edits.includes(:account, status: [:account]), each_serializer: REST::StatusEditSerializer
|
||||||
render json: status_edits, each_serializer: REST::StatusEditSerializer
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def status_edits
|
|
||||||
@status.edits.includes(:account, status: [:account]).to_a.presence || [@status.build_snapshot(at_time: @status.edited_at || @status.created_at)]
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_status
|
def set_status
|
||||||
@status = Status.find(params[:status_id])
|
@status = Status.find(params[:status_id])
|
||||||
authorize @status, :show?
|
authorize @status, :show?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user