Merge remote-tracking branch 'parent/main' into upstream-20240716
This commit is contained in:
commit
adee1645a3
203 changed files with 1707 additions and 1067 deletions
|
@ -1046,7 +1046,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(status.mentions.map(&:account_id)).to contain_exactly(recipient.id, ancestor_account.id, mentioned_account.id, local_mentioned_account.id)
|
||||
end
|
||||
|
||||
it 'forwards to observers', :sidekiq_inline do
|
||||
it 'forwards to observers', :inline_jobs do
|
||||
expect(a_request(:post, 'http://or.example.com/actor/inbox')).to have_been_made.once
|
||||
expect(a_request(:post, 'http://example.com/bob/inbox')).to have_been_made.once
|
||||
end
|
||||
|
@ -1089,7 +1089,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(status.mentions.map(&:account_id)).to contain_exactly(recipient.id, ancestor_account.id, mentioned_account.id, local_mentioned_account.id, new_mentioned_account.id, new_local_mentioned_account.id)
|
||||
end
|
||||
|
||||
it 'forwards to observers', :sidekiq_inline do
|
||||
it 'forwards to observers', :inline_jobs do
|
||||
expect(a_request(:post, 'http://or.example.com/actor/inbox')).to have_been_made.once
|
||||
expect(a_request(:post, 'http://example.com/bob/inbox')).to have_been_made.once
|
||||
expect(a_request(:post, 'http://example.com/alice/inbox')).to have_been_made.once
|
||||
|
@ -1142,7 +1142,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(status.mentioned_accounts.map(&:uri)).to include 'https://foo.test'
|
||||
end
|
||||
|
||||
it 'forwards to observers', :sidekiq_inline do
|
||||
it 'forwards to observers', :inline_jobs do
|
||||
expect(a_request(:post, 'https://foo.test/inbox')).to have_been_made.once
|
||||
end
|
||||
end
|
||||
|
@ -1159,7 +1159,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
expect(status.mentions.map(&:account_id)).to contain_exactly(recipient.id)
|
||||
end
|
||||
|
||||
it 'do not forward to observers', :sidekiq_inline do
|
||||
it 'do not forward to observers', :inline_jobs do
|
||||
expect(a_request(:post, 'http://or.example.com/actor/inbox')).to_not have_been_made
|
||||
expect(a_request(:post, 'http://example.com/bob/inbox')).to_not have_been_made
|
||||
end
|
||||
|
|
|
@ -47,7 +47,7 @@ RSpec.describe ActivityPub::Activity::Delete do
|
|||
expect(Status.find_by(id: status.id)).to be_nil
|
||||
end
|
||||
|
||||
it 'sends delete activity to followers of rebloggers', :sidekiq_inline do
|
||||
it 'sends delete activity to followers of rebloggers', :inline_jobs do
|
||||
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
|
||||
end
|
||||
|
||||
|
@ -91,7 +91,7 @@ RSpec.describe ActivityPub::Activity::Delete do
|
|||
subject.perform
|
||||
end
|
||||
|
||||
it 'forwards to parent status holder', :sidekiq_inline do
|
||||
it 'forwards to parent status holder', :inline_jobs do
|
||||
expect(a_request(:post, 'https://example.com/inbox').with(body: hash_including({
|
||||
type: 'Delete',
|
||||
signature: 'foo',
|
||||
|
|
|
@ -455,7 +455,7 @@ RSpec.describe ActivityPub::Activity::Follow do
|
|||
stub_request(:post, 'https://example.com/inbox')
|
||||
end
|
||||
|
||||
it 'marks me as idle and the friend as accepted', :sidekiq_inline do
|
||||
it 'marks me as idle and the friend as accepted', :inline_jobs do
|
||||
subject.perform
|
||||
expect(friend.reload.they_are_accepted?).to be true
|
||||
expect(friend.i_am_idle?).to be true
|
||||
|
@ -503,7 +503,7 @@ RSpec.describe ActivityPub::Activity::Follow do
|
|||
stub_request(:post, 'https://example.com/inbox')
|
||||
end
|
||||
|
||||
it 'marks the friend as accepted', :sidekiq_inline do
|
||||
it 'marks the friend as accepted', :inline_jobs do
|
||||
subject.perform
|
||||
|
||||
friend = FriendDomain.find_by(domain: 'abc.com')
|
||||
|
@ -523,7 +523,7 @@ RSpec.describe ActivityPub::Activity::Follow do
|
|||
stub_request(:post, 'https://example.com/inbox')
|
||||
end
|
||||
|
||||
it 'marks the friend as accepted', :sidekiq_inline do
|
||||
it 'marks the friend as accepted', :inline_jobs do
|
||||
subject.perform
|
||||
|
||||
friend = FriendDomain.find_by(domain: 'abc.com')
|
||||
|
|
|
@ -38,7 +38,7 @@ RSpec.describe ActivityPub::Activity::Move do
|
|||
subject.perform
|
||||
end
|
||||
|
||||
context 'when all conditions are met', :sidekiq_inline do
|
||||
context 'when all conditions are met', :inline_jobs do
|
||||
it 'sets moved account on old account' do
|
||||
expect(old_account.reload.moved_to_account_id).to eq new_account.id
|
||||
end
|
||||
|
|
|
@ -138,7 +138,7 @@ RSpec.describe ActivityPub::Activity::Update do
|
|||
subject.perform
|
||||
end
|
||||
|
||||
it 'does not create a new status', :sidekiq_inline do
|
||||
it 'does not create a new status', :inline_jobs do
|
||||
status = Status.find_by(uri: 'https://example.com/note')
|
||||
expect(status).to be_nil
|
||||
end
|
||||
|
@ -170,7 +170,7 @@ RSpec.describe ActivityPub::Activity::Update do
|
|||
subject.perform
|
||||
end
|
||||
|
||||
it 'forwards to parent status holder', :sidekiq_inline do
|
||||
it 'forwards to parent status holder', :inline_jobs do
|
||||
expect(a_request(:post, 'https://example.com/inbox').with(body: hash_including({
|
||||
type: 'Update',
|
||||
signature: 'foo',
|
||||
|
|
|
@ -192,6 +192,35 @@ RSpec.describe LinkDetailsExtractor do
|
|||
|
||||
include_examples 'structured data'
|
||||
end
|
||||
|
||||
context 'with author names as array' do
|
||||
let(:ld_json) do
|
||||
{
|
||||
'@context' => 'https://schema.org',
|
||||
'@type' => 'NewsArticle',
|
||||
'headline' => 'A lot of authors',
|
||||
'description' => 'But we decided to cram them into one',
|
||||
'author' => {
|
||||
'@type' => 'Person',
|
||||
'name' => ['Author 1', 'Author 2'],
|
||||
},
|
||||
}.to_json
|
||||
end
|
||||
let(:html) { <<~HTML }
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<script type="application/ld+json">
|
||||
#{ld_json}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
HTML
|
||||
|
||||
it 'joins author names' do
|
||||
expect(subject.author_name).to eq 'Author 1, Author 2'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when Open Graph protocol data is present' do
|
||||
|
|
|
@ -17,32 +17,21 @@ RSpec.describe Vacuum::MediaAttachmentsVacuum do
|
|||
let!(:old_unattached_media) { Fabricate(:media_attachment, account_id: nil, created_at: 10.days.ago) }
|
||||
let!(:new_unattached_media) { Fabricate(:media_attachment, account_id: nil, created_at: 1.hour.ago) }
|
||||
|
||||
before do
|
||||
subject.perform
|
||||
end
|
||||
before { subject.perform }
|
||||
|
||||
it 'deletes cache of remote media attachments past the retention period' do
|
||||
expect(old_remote_media.reload.file).to be_blank
|
||||
end
|
||||
|
||||
it 'does not touch local media attachments past the retention period' do
|
||||
expect(old_local_media.reload.file).to_not be_blank
|
||||
end
|
||||
|
||||
it 'does not delete cache of remote media attachments within the retention period' do
|
||||
expect(new_remote_media.reload.file).to_not be_blank
|
||||
end
|
||||
|
||||
it 'does not touch local media attachments within the retention period' do
|
||||
expect(new_local_media.reload.file).to_not be_blank
|
||||
end
|
||||
|
||||
it 'deletes unattached media attachments past TTL' do
|
||||
expect { old_unattached_media.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it 'does not delete unattached media attachments within TTL' do
|
||||
expect(new_unattached_media.reload).to be_persisted
|
||||
it 'handles attachments based on metadata details' do
|
||||
expect(old_remote_media.reload.file) # Remote and past retention period
|
||||
.to be_blank
|
||||
expect(old_local_media.reload.file) # Local and past retention
|
||||
.to_not be_blank
|
||||
expect(new_remote_media.reload.file) # Remote and within retention
|
||||
.to_not be_blank
|
||||
expect(new_local_media.reload.file) # Local and within retention
|
||||
.to_not be_blank
|
||||
expect { old_unattached_media.reload } # Unattached and past TTL
|
||||
.to raise_error(ActiveRecord::RecordNotFound)
|
||||
expect(new_unattached_media.reload) # Unattached and within TTL
|
||||
.to be_persisted
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue