diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index 86c4ff641..8d5446f1a 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -8,7 +8,6 @@ class SuspendAccountService < BaseService def call(account) return unless account.suspended? - @relationship_severance_event = nil @account = account reject_remote_follows! @@ -16,7 +15,6 @@ class SuspendAccountService < BaseService unmerge_from_home_timelines! unmerge_from_list_timelines! privatize_media_attachments! - notify_of_severed_relationships! end private @@ -38,8 +36,6 @@ class SuspendAccountService < BaseService [Oj.dump(serialize_payload(follow, ActivityPub::RejectFollowSerializer)), follow.target_account_id, @account.inbox_url] end - relationship_severance_event.import_from_passive_follows!(follows) - follows.each(&:destroy) end end @@ -105,21 +101,7 @@ class SuspendAccountService < BaseService end end - def notify_of_severed_relationships! - return if @relationship_severance_event.nil? - - # TODO: check how efficient that query is, also check `push_bulk`/`perform_bulk` - @relationship_severance_event.affected_local_accounts.reorder(nil).find_each do |account| - event = AccountRelationshipSeveranceEvent.create!(account: account, relationship_severance_event: @relationship_severance_event) - LocalNotificationWorker.perform_async(account.id, event.id, 'AccountRelationshipSeveranceEvent', 'severed_relationships') - end - end - def signed_activity_json @signed_activity_json ||= Oj.dump(serialize_payload(@account, ActivityPub::UpdateSerializer, signer: @account)) end - - def relationship_severance_event - @relationship_severance_event ||= RelationshipSeveranceEvent.create!(type: :account_suspension, target_name: @account.acct) - end end diff --git a/spec/services/suspend_account_service_spec.rb b/spec/services/suspend_account_service_spec.rb index 74ef8f60e..7c72a4776 100644 --- a/spec/services/suspend_account_service_spec.rb +++ b/spec/services/suspend_account_service_spec.rb @@ -85,14 +85,10 @@ RSpec.describe SuspendAccountService, :sidekiq_inline do account.follow!(local_followee) end - it 'sends a Reject Follow activity, and records severed relationships', :aggregate_failures do + it 'sends a Reject Follow activity', :aggregate_failures do subject expect(a_request(:post, account.inbox_url).with { |req| match_reject_follow_request(req, account, local_followee) }).to have_been_made.once - - severed_relationships = local_followee.severed_relationships.to_a - expect(severed_relationships.count).to eq 1 - expect(severed_relationships.map { |rel| [rel.account, rel.target_account] }).to contain_exactly([account, local_followee]) end end end