Fix domain hiding logic (#7765)
* Send rejections to followers when user hides domain they're on * Use account domain blocks for "authorized followers" action Replace soft-blocking (block & unblock) behaviour with follow rejection * Split sync and async work of account domain blocking Do not create domain block when removing followers by domain, that is probably unexpected from the user's perspective. * Adjust confirmation message for domain block * yarn manage:translations
This commit is contained in:
		@@ -0,0 +1,25 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe AfterBlockDomainFromAccountService, type: :service do
 | 
			
		||||
  let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org', inbox_url: 'https://evil.org/inbox', protocol: :activitypub) }
 | 
			
		||||
  let!(:alice) { Fabricate(:account, username: 'alice') }
 | 
			
		||||
 | 
			
		||||
  subject { AfterBlockDomainFromAccountService.new }
 | 
			
		||||
 | 
			
		||||
  before do
 | 
			
		||||
    stub_jsonld_contexts!
 | 
			
		||||
    allow(ActivityPub::DeliveryWorker).to receive(:perform_async)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'purge followers from blocked domain' do
 | 
			
		||||
    wolf.follow!(alice)
 | 
			
		||||
    subject.call(alice, 'evil.org')
 | 
			
		||||
    expect(wolf.following?(alice)).to be false
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'sends Reject->Follow to followers from blocked domain' do
 | 
			
		||||
    wolf.follow!(alice)
 | 
			
		||||
    subject.call(alice, 'evil.org')
 | 
			
		||||
    expect(ActivityPub::DeliveryWorker).to have_received(:perform_async).once
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
@@ -1,19 +0,0 @@
 | 
			
		||||
require 'rails_helper'
 | 
			
		||||
 | 
			
		||||
RSpec.describe BlockDomainFromAccountService, type: :service do
 | 
			
		||||
  let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org') }
 | 
			
		||||
  let!(:alice) { Fabricate(:account, username: 'alice') }
 | 
			
		||||
 | 
			
		||||
  subject { BlockDomainFromAccountService.new }
 | 
			
		||||
 | 
			
		||||
  it 'creates domain block' do
 | 
			
		||||
    subject.call(alice, 'evil.org')
 | 
			
		||||
    expect(alice.domain_blocking?('evil.org')).to be true
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  it 'purge followers from blocked domain' do
 | 
			
		||||
    wolf.follow!(alice)
 | 
			
		||||
    subject.call(alice, 'evil.org')
 | 
			
		||||
    expect(wolf.following?(alice)).to be false
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
		Reference in New Issue
	
	Block a user