mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-14 02:44:13 +00:00
230a012f00
* Add polls Fix #1629 * Add tests * Fixes * Change API for creating polls * Use name instead of content for votes * Remove poll validation for remote polls * Add polls to public pages * When updating the poll, update options just in case they were changed * Fix public pages showing both poll and other media
14 lines
451 B
Ruby
14 lines
451 B
Ruby
# 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
|