about summary refs log tree commit diff
path: root/app/controllers/api/v1/polls_controller.rb
blob: 4f4a6858dbac1890d51c4304b1e4005466455181 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# 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