mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-13 07:48:15 +00:00

Only share statuses where the account has `#indexable` set to `true`. Only share accounts where `#discoverable` is set to `true`, with one exception: If `#discoverable` has just been set to `false` this is an important information for the fasp.
35 lines
1.0 KiB
Ruby
35 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Account::FaspConcern
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
after_commit :announce_new_account_to_subscribed_fasp, on: :create
|
|
after_commit :announce_updated_account_to_subscribed_fasp, on: :update
|
|
after_commit :announce_deleted_account_to_subscribed_fasp, on: :destroy
|
|
end
|
|
|
|
private
|
|
|
|
def announce_new_account_to_subscribed_fasp
|
|
return unless discoverable?
|
|
|
|
uri = ActivityPub::TagManager.instance.uri_for(self)
|
|
Fasp::AnnounceAccountLifecycleEventWorker.perform_async(uri, 'new')
|
|
end
|
|
|
|
def announce_updated_account_to_subscribed_fasp
|
|
return unless discoverable? || saved_change_to_discoverable?
|
|
|
|
uri = ActivityPub::TagManager.instance.uri_for(self)
|
|
Fasp::AnnounceAccountLifecycleEventWorker.perform_async(uri, 'update')
|
|
end
|
|
|
|
def announce_deleted_account_to_subscribed_fasp
|
|
return unless discoverable?
|
|
|
|
uri = ActivityPub::TagManager.instance.uri_for(self)
|
|
Fasp::AnnounceAccountLifecycleEventWorker.perform_async(uri, 'delete')
|
|
end
|
|
end
|