sources_controller.rb 469 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. class Api::V1::Statuses::SourcesController < Api::BaseController
  3. include Authorization
  4. before_action -> { doorkeeper_authorize! :read, :'read:statuses' }
  5. before_action :set_status
  6. def show
  7. render json: @status, serializer: REST::StatusSourceSerializer
  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