blob: 97c052e22464fc6c0614b7ae0907b09b5a27e78a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# frozen_string_literal: true
class Api::V1::Statuses::PublishingController < Api::BaseController
include Authorization
before_action -> { doorkeeper_authorize! :write, :'write:statuses:publish' }
before_action :require_user!
before_action :set_status
def create
PublishStatusService.new.call(@status)
render json: @status,
serializer: (@status.is_a?(ScheduledStatus) ? REST::ScheduledStatusSerializer : REST::StatusSerializer),
source_requested: truthy_param?(:source)
end
private
def set_status
@status = Status.unpublished.find(params[:status_id])
authorize @status, :destroy?
rescue Mastodon::NotPermittedError
not_found
end
end
|