diff --git a/app/models/concerns/account/fasp_concern.rb b/app/models/concerns/account/fasp_concern.rb index 01717d396c..6c1d6cc710 100644 --- a/app/models/concerns/account/fasp_concern.rb +++ b/app/models/concerns/account/fasp_concern.rb @@ -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 diff --git a/app/models/concerns/status/fasp_concern.rb b/app/models/concerns/status/fasp_concern.rb index 30c7898324..bc0779e39c 100644 --- a/app/models/concerns/status/fasp_concern.rb +++ b/app/models/concerns/status/fasp_concern.rb @@ -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'] diff --git a/app/models/status.rb b/app/models/status.rb index 122f57df57..b76acf53b3 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -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 diff --git a/app/workers/fasp/announce_trend_worker.rb b/app/workers/fasp/announce_trend_worker.rb index 0d5fc6db48..687871ff2e 100644 --- a/app/workers/fasp/announce_trend_worker.rb +++ b/app/workers/fasp/announce_trend_worker.rb @@ -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