Merge remote-tracking branch 'parent/main' into upstream-20240913
This commit is contained in:
commit
fc9d27ff91
392 changed files with 3757 additions and 3233 deletions
|
@ -454,6 +454,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
|
||||
|
|
|
@ -194,8 +194,8 @@ RSpec.describe FetchLinkCardService do
|
|||
context 'when encoding problems appear in title tag' do
|
||||
let(:status) { Fabricate(:status, text: 'Check out http://example.com/latin1_posing_as_utf8_broken') }
|
||||
|
||||
it 'does not create a preview card' do
|
||||
expect(status.preview_card).to be_nil
|
||||
it 'creates a preview card anyway that replaces invalid bytes with U+FFFD (replacement char)' do
|
||||
expect(status.preview_card.title).to eq("Tofu <20> l'orange")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -68,7 +68,10 @@ RSpec.describe PostStatusService do
|
|||
it 'raises invalid record error' do
|
||||
expect do
|
||||
subject.call(account, text: 'Hi future!', scheduled_at: invalid_scheduled_time)
|
||||
end.to raise_error(ActiveRecord::RecordInvalid)
|
||||
end.to raise_error(
|
||||
ActiveRecord::RecordInvalid,
|
||||
'Validation failed: Scheduled at The scheduled date must be in the future'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -123,6 +126,15 @@ RSpec.describe PostStatusService do
|
|||
expect(status.visibility).to eq 'private'
|
||||
end
|
||||
|
||||
it 'raises on an invalid visibility' do
|
||||
expect do
|
||||
create_status_with_options(visibility: :xxx)
|
||||
end.to raise_error(
|
||||
ActiveRecord::RecordInvalid,
|
||||
'Validation failed: Visibility is not included in the list'
|
||||
)
|
||||
end
|
||||
|
||||
it 'creates a status with limited visibility for silenced users' do
|
||||
status = subject.call(Fabricate(:account, silenced: true), text: 'test', visibility: :public)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue