histories_controller.rb 521 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. class Api::V1::Statuses::HistoriesController < Api::BaseController
  3. include Authorization
  4. before_action -> { authorize_if_got_token! :read, :'read:statuses' }
  5. before_action :set_status
  6. def show
  7. render json: @status.edits.includes(:account, status: [:account]), each_serializer: REST::StatusEditSerializer
  8. end
  9. private
  10. def set_status
  11. @status = Status.find(params[:status_id])
  12. authorize @status, :show?
  13. rescue Mastodon::NotPermittedError
  14. not_found
  15. end
  16. end