mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-30 20:03:43 +01: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
13 lines
451 B
Ruby
13 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
|