Add ability to manage which websites can credit you in link previews (#31819)
This commit is contained in:
parent
3929e3c6d2
commit
e0c27a5047
92 changed files with 381 additions and 160 deletions
|
@ -63,6 +63,26 @@ RSpec.describe ActivityPub::ProcessAccountService do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with attribution domains' do
|
||||
let(:payload) do
|
||||
{
|
||||
id: 'https://foo.test',
|
||||
type: 'Actor',
|
||||
inbox: 'https://foo.test/inbox',
|
||||
attributionDomains: [
|
||||
'example.com',
|
||||
],
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
||||
it 'parses attribution domains' do
|
||||
account = subject.call('alice', 'example.com', payload)
|
||||
|
||||
expect(account.attribution_domains)
|
||||
.to match_array(%w(example.com))
|
||||
end
|
||||
end
|
||||
|
||||
context 'when account is not suspended' do
|
||||
subject { described_class.new.call(account.username, account.domain, payload) }
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ RSpec.describe BulkImportService do
|
|||
let(:rows) do
|
||||
[
|
||||
{ 'domain' => 'blocked.com' },
|
||||
{ 'domain' => 'to_block.com' },
|
||||
{ 'domain' => 'to-block.com' },
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -286,7 +286,7 @@ RSpec.describe BulkImportService do
|
|||
|
||||
it 'blocks all the new domains' do
|
||||
subject.call(import)
|
||||
expect(account.domain_blocks.pluck(:domain)).to contain_exactly('alreadyblocked.com', 'blocked.com', 'to_block.com')
|
||||
expect(account.domain_blocks.pluck(:domain)).to contain_exactly('alreadyblocked.com', 'blocked.com', 'to-block.com')
|
||||
end
|
||||
|
||||
it 'marks the import as finished' do
|
||||
|
@ -302,7 +302,7 @@ RSpec.describe BulkImportService do
|
|||
let(:rows) do
|
||||
[
|
||||
{ 'domain' => 'blocked.com' },
|
||||
{ 'domain' => 'to_block.com' },
|
||||
{ 'domain' => 'to-block.com' },
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -314,7 +314,7 @@ RSpec.describe BulkImportService do
|
|||
|
||||
it 'blocks all the new domains' do
|
||||
subject.call(import)
|
||||
expect(account.domain_blocks.pluck(:domain)).to contain_exactly('blocked.com', 'to_block.com')
|
||||
expect(account.domain_blocks.pluck(:domain)).to contain_exactly('blocked.com', 'to-block.com')
|
||||
end
|
||||
|
||||
it 'marks the import as finished' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue