mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 17:31:12 +00:00
34 lines
926 B
Ruby
34 lines
926 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::V1::Statuses::InteractionPoliciesController < Api::V1::Statuses::BaseController
|
|
include Api::InteractionPoliciesConcern
|
|
|
|
before_action -> { doorkeeper_authorize! :write, :'write:statuses' }
|
|
before_action -> { check_feature_enabled }
|
|
|
|
def update
|
|
authorize @status, :update?
|
|
|
|
@status.update!(quote_approval_policy: quote_approval_policy)
|
|
|
|
broadcast_updates! if @status.quote_approval_policy_previously_changed?
|
|
|
|
render json: @status, serializer: REST::StatusSerializer
|
|
end
|
|
|
|
private
|
|
|
|
def status_params
|
|
params.permit(:quote_approval_policy)
|
|
end
|
|
|
|
def check_feature_enabled
|
|
raise ActionController::RoutingError unless Mastodon::Feature.outgoing_quotes_enabled?
|
|
end
|
|
|
|
def broadcast_updates!
|
|
DistributionWorker.perform_async(@status.id, { 'update' => true })
|
|
ActivityPub::StatusUpdateDistributionWorker.perform_async(@status.id)
|
|
end
|
|
end
|