mastodon/app/controllers/api/v1/accounts/circles_controller.rb
Eugen Rochko 6358072bc0 Add REST API for managing and posting to circles
Circles are the conceptual opposite of lists. A list is a subdivision
of your follows, a circle is a subdivision of your followers. Posting
to a circle means making content available to only some of your
followers. Circles have been internally supported in Mastodon for
the purposes of federation since #8950, this adds the REST API
necessary for making use of them in Mastodon itsef.
2020-07-19 02:05:16 +02:00

18 lines
463 B
Ruby

# frozen_string_literal: true
class Api::V1::Accounts::CirclesController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:circles' }
before_action :require_user!
before_action :set_account
def index
@circles = @account.circles.where(account: current_account)
render json: @circles, each_serializer: REST::CircleSerializer
end
private
def set_account
@account = Account.find(params[:account_id])
end
end