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.
This commit is contained in:
Eugen Rochko 2020-07-19 02:05:16 +02:00
parent a29080256e
commit 6358072bc0
19 changed files with 353 additions and 4 deletions

View file

@ -7,7 +7,8 @@ class ProcessMentionsService < BaseService
# local mention pointers, send Salmon notifications to mentioned
# remote users
# @param [Status] status
def call(status)
# @param [Circle] circle
def call(status, circle = nil)
return unless status.local?
@status = status
@ -41,6 +42,12 @@ class ProcessMentionsService < BaseService
"@#{mentioned_account.acct}"
end
if circle.present?
circle.accounts.find_each do |target_account|
status.mentions.create(silent: true, account: target_account)
end
end
status.save!
check_for_spam(status)