Merge remote-tracking branch 'parent/main' into upstream-20231221
This commit is contained in:
commit
a6b57e3890
154 changed files with 7762 additions and 1748 deletions
|
@ -28,13 +28,8 @@ RSpec.describe AppSignUpService, type: :service do
|
|||
end
|
||||
|
||||
context 'when registrations are closed' do
|
||||
around do |example|
|
||||
tmp = Setting.registrations_mode
|
||||
before do
|
||||
Setting.registrations_mode = 'none'
|
||||
|
||||
example.run
|
||||
|
||||
Setting.registrations_mode = tmp
|
||||
end
|
||||
|
||||
it 'raises an error', :aggregate_failures do
|
||||
|
|
|
@ -90,11 +90,11 @@ RSpec.describe DeleteAccountService, type: :service do
|
|||
end
|
||||
|
||||
def delete_associated_target_records
|
||||
change do
|
||||
[
|
||||
AccountPin.where(target_account: account),
|
||||
].map(&:count)
|
||||
end.from([1]).to([0])
|
||||
change(account_pins_for_account, :count).from(1).to(0)
|
||||
end
|
||||
|
||||
def account_pins_for_account
|
||||
AccountPin.where(target_account: account)
|
||||
end
|
||||
|
||||
def delete_associated_target_notifications
|
||||
|
@ -140,28 +140,34 @@ RSpec.describe DeleteAccountService, type: :service do
|
|||
it 'sends expected activities to followed and follower inboxes' do
|
||||
subject
|
||||
|
||||
expect(a_request(:post, account.inbox_url).with(
|
||||
body:
|
||||
hash_including({
|
||||
'type' => 'Reject',
|
||||
'object' => hash_including({
|
||||
'type' => 'Follow',
|
||||
'actor' => account.uri,
|
||||
'object' => ActivityPub::TagManager.instance.uri_for(local_follower),
|
||||
}),
|
||||
})
|
||||
)).to have_been_made.once
|
||||
expect(post_to_inbox_with_reject).to have_been_made.once
|
||||
expect(post_to_inbox_with_undo).to have_been_made.once
|
||||
end
|
||||
|
||||
expect(a_request(:post, account.inbox_url).with(
|
||||
body: hash_including({
|
||||
'type' => 'Undo',
|
||||
'object' => hash_including({
|
||||
'type' => 'Follow',
|
||||
'actor' => ActivityPub::TagManager.instance.uri_for(local_follower),
|
||||
'object' => account.uri,
|
||||
}),
|
||||
})
|
||||
)).to have_been_made.once
|
||||
def post_to_inbox_with_undo
|
||||
a_request(:post, account.inbox_url).with(
|
||||
body: hash_including({
|
||||
'type' => 'Undo',
|
||||
'object' => hash_including({
|
||||
'type' => 'Follow',
|
||||
'actor' => ActivityPub::TagManager.instance.uri_for(local_follower),
|
||||
'object' => account.uri,
|
||||
}),
|
||||
})
|
||||
)
|
||||
end
|
||||
|
||||
def post_to_inbox_with_reject
|
||||
a_request(:post, account.inbox_url).with(
|
||||
body: hash_including({
|
||||
'type' => 'Reject',
|
||||
'object' => hash_including({
|
||||
'type' => 'Follow',
|
||||
'actor' => account.uri,
|
||||
'object' => ActivityPub::TagManager.instance.uri_for(local_follower),
|
||||
}),
|
||||
})
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,14 +10,17 @@ RSpec.describe UpdateAccountService, type: :service do
|
|||
let(:alice) { Fabricate(:account) }
|
||||
let(:bob) { Fabricate(:account) }
|
||||
let(:eve) { Fabricate(:account) }
|
||||
let(:ohagi) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') }
|
||||
|
||||
before do
|
||||
bob.touch(:silenced_at)
|
||||
account.mute!(eve)
|
||||
Fabricate(:domain_block, domain: 'example.com', reject_straight_follow: true)
|
||||
|
||||
FollowService.new.call(alice, account)
|
||||
FollowService.new.call(bob, account)
|
||||
FollowService.new.call(eve, account)
|
||||
FollowService.new.call(ohagi, account)
|
||||
|
||||
subject.call(account, { locked: false })
|
||||
end
|
||||
|
@ -36,5 +39,10 @@ RSpec.describe UpdateAccountService, type: :service do
|
|||
expect(eve.following?(account)).to be true
|
||||
expect(eve.requested?(account)).to be false
|
||||
end
|
||||
|
||||
it 'does not auto-accept pending follow requests from blocking straight follow domains' do
|
||||
expect(ohagi.following?(account)).to be false
|
||||
expect(ohagi.requested?(account)).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue