Undo notification permissions on individual and domain blocks (#29570)
This commit is contained in:
parent
7508472d84
commit
9c24f2d6b1
4 changed files with 18 additions and 12 deletions
|
@ -10,20 +10,17 @@ RSpec.describe AfterBlockDomainFromAccountService do
|
|||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
before do
|
||||
NotificationPermission.create!(account: alice, from_account: wolf)
|
||||
|
||||
wolf.follow!(alice)
|
||||
alice.follow!(dog)
|
||||
end
|
||||
|
||||
around do |example|
|
||||
Sidekiq::Testing.fake! do
|
||||
example.run
|
||||
end
|
||||
end
|
||||
it 'purge followers from blocked domain, remove notification permissions, sends `Reject->Follow`, and records severed relationships', :aggregate_failures do
|
||||
expect { subject.call(alice, 'evil.org') }
|
||||
.to change { wolf.following?(alice) }.from(true).to(false)
|
||||
.and change { NotificationPermission.exists?(account: alice, from_account: wolf) }.from(true).to(false)
|
||||
|
||||
it 'purges followers from blocked domain, sends them Reject->Follow, and records severed relationships', :aggregate_failures do
|
||||
subject.call(alice, 'evil.org')
|
||||
|
||||
expect(wolf.following?(alice)).to be false
|
||||
expect(ActivityPub::DeliveryWorker.jobs.pluck('args')).to contain_exactly(
|
||||
[a_string_including('"type":"Reject"'), alice.id, wolf.inbox_url],
|
||||
[a_string_including('"type":"Undo"'), alice.id, dog.inbox_url]
|
||||
|
|
|
@ -11,11 +11,13 @@ RSpec.describe BlockService do
|
|||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
subject.call(sender, bob)
|
||||
NotificationPermission.create!(account: sender, from_account: bob)
|
||||
end
|
||||
|
||||
it 'creates a blocking relation' do
|
||||
expect(sender.blocking?(bob)).to be true
|
||||
it 'creates a blocking relation and removes notification permissions' do
|
||||
expect { subject.call(sender, bob) }
|
||||
.to change { sender.blocking?(bob) }.from(false).to(true)
|
||||
.and change { NotificationPermission.exists?(account: sender, from_account: bob) }.from(true).to(false)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue