1
0
mirror of https://github.com/mastodon/mastodon synced 2024-12-21 10:08:13 +09:00
mastodon/app/controllers/api/v1/polls_controller.rb

14 lines
451 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Api::V1::PollsController < Api::BaseController
before_action -> { authorize_if_got_token! :read, :'read:statuses' }, only: :show
respond_to :json
def show
@poll = Poll.attached.find(params[:id])
ActivityPub::FetchRemotePollService.new.call(@poll, current_account) if user_signed_in? && @poll.possibly_stale?
render json: @poll, serializer: REST::PollSerializer, include_results: true
end
end