mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-28 22:15:06 +01:00
Select what to share with fasp
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.
This commit is contained in:
parent
d132bc6fa1
commit
e01429d255
@ -12,16 +12,22 @@ module Account::FaspConcern
|
||||
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
|
||||
|
@ -13,19 +13,27 @@ module Status::FaspConcern
|
||||
private
|
||||
|
||||
def announce_new_content_to_subscribed_fasp
|
||||
return unless account_indexable?
|
||||
|
||||
store_uri unless uri # TODO: solve this more elegantly
|
||||
Fasp::AnnounceContentLifecycleEventWorker.perform_async(uri, 'new')
|
||||
end
|
||||
|
||||
def announce_updated_content_to_subscribed_fasp
|
||||
return unless account_indexable?
|
||||
|
||||
Fasp::AnnounceContentLifecycleEventWorker.perform_async(uri, 'update')
|
||||
end
|
||||
|
||||
def announce_deleted_content_to_subscribed_fasp
|
||||
return unless account_indexable?
|
||||
|
||||
Fasp::AnnounceContentLifecycleEventWorker.perform_async(uri, 'delete')
|
||||
end
|
||||
|
||||
def announce_trends_to_subscribed_fasp
|
||||
return unless account_indexable?
|
||||
|
||||
candidate_id, trend_source =
|
||||
if reblog_of_id
|
||||
[reblog_of_id, 'reblog']
|
||||
|
@ -175,7 +175,7 @@ class Status < ApplicationRecord
|
||||
],
|
||||
thread: :account
|
||||
|
||||
delegate :domain, to: :account, prefix: true
|
||||
delegate :domain, :indexable, to: :account, prefix: true
|
||||
|
||||
REAL_TIME_WINDOW = 6.hours
|
||||
|
||||
|
@ -6,7 +6,9 @@ class Fasp::AnnounceTrendWorker
|
||||
sidekiq_options queue: 'fasp', retry: 5
|
||||
|
||||
def perform(status_id, trend_source)
|
||||
status = ::Status.find(status_id)
|
||||
status = ::Status.includes(:account).find(status_id)
|
||||
return unless status.account.indexable?
|
||||
|
||||
Fasp::Subscription.includes(:fasp_provider).content.trends.each do |subscription|
|
||||
announce(subscription, status.uri) if trending?(subscription, status, trend_source)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user