Merge commit '989ca63b596c9006c5606edd4e66498e29e83489' into glitch-soc/merge-upstream

This commit is contained in:
Claire
2025-06-06 12:56:00 +02:00
25 changed files with 166 additions and 99 deletions

View File

@@ -937,7 +937,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'with an unverifiable quote of a known post', feature: :inbound_quotes do
context 'with an unverifiable quote of a known post' do
let(:quoted_status) { Fabricate(:status) }
let(:object_json) do
@@ -961,7 +961,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'with an unverifiable unknown post', feature: :inbound_quotes do
context 'with an unverifiable unknown post' do
let(:unknown_post_uri) { 'https://unavailable.example.com/unavailable-post' }
let(:object_json) do
@@ -989,7 +989,7 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'with a verifiable quote of a known post', feature: :inbound_quotes do
context 'with a verifiable quote of a known post' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }
let(:approval_uri) { 'https://quoted.example.com/quote-approval' }

View File

@@ -2,7 +2,7 @@
require 'rails_helper'
RSpec.describe ActivityPub::Activity::QuoteRequest, feature: :inbound_quotes do
RSpec.describe ActivityPub::Activity::QuoteRequest do
let(:sender) { Fabricate(:account, domain: 'example.com') }
let(:recipient) { Fabricate(:account) }
let(:quoted_post) { Fabricate(:status, account: recipient) }

View File

@@ -56,9 +56,10 @@ RSpec.describe StatusCacheHydrator do
context 'when handling an approved quote' do
let(:quoted_status) { Fabricate(:status) }
let(:legacy) { false }
before do
Fabricate(:quote, status: status, quoted_status: quoted_status, state: :accepted)
Fabricate(:quote, status: status, quoted_status: quoted_status, state: :accepted, legacy: legacy)
end
it 'renders the same attributes as full render' do
@@ -75,13 +76,46 @@ RSpec.describe StatusCacheHydrator do
end
end
context 'when the quote post is a legacy quote' do
let(:legacy) { true }
it 'renders the same attributes as full render' do
expect(subject).to eql(compare_to_hash)
expect(subject[:quote]).to_not be_nil
end
end
context 'when the quoted post is a private post the viewer is not authorized to see' do
let(:quoted_status) { Fabricate(:status, account: status.account, visibility: :private) }
it 'renders the same attributes as full render' do
expect(subject).to eql(compare_to_hash)
expect(subject[:quote]).to_not be_nil
expect(subject[:quote][:quoted_status]).to be_nil
end
end
context 'when the quoted post is a private post the viewer is authorized to see' do
let(:quoted_status) { Fabricate(:status, account: status.account, visibility: :private) }
before do
account.follow!(quoted_status.account)
end
it 'renders the same attributes as full render' do
expect(subject).to eql(compare_to_hash)
expect(subject[:quote]).to_not be_nil
expect(subject[:quote][:quoted_status]).to_not be_nil
end
end
context 'when the quoted post has been deleted' do
let(:quoted_status) { nil }
it 'returns the same attributes as full render' do
expect(subject).to eql(compare_to_hash)
expect(subject[:quote]).to_not be_nil
expect(subject[:quote_status]).to be_nil
expect(subject[:quote][:quoted_status]).to be_nil
end
end
@@ -93,7 +127,7 @@ RSpec.describe StatusCacheHydrator do
it 'returns the same attributes as full render' do
expect(subject).to eql(compare_to_hash)
expect(subject[:quote]).to_not be_nil
expect(subject[:quote_status]).to be_nil
expect(subject[:quote][:quoted_status]).to be_nil
end
end

View File

@@ -435,7 +435,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status has an existing unverified quote and adds an approval link', feature: :inbound_quotes do
context 'when the status has an existing unverified quote and adds an approval link' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }
let!(:quote) { Fabricate(:quote, status: status, quoted_status: quoted_status, approval_uri: nil) }
@@ -500,7 +500,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status has an existing verified quote and removes an approval link', feature: :inbound_quotes do
context 'when the status has an existing verified quote and removes an approval link' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }
let!(:quote) { Fabricate(:quote, status: status, quoted_status: quoted_status, approval_uri: approval_uri, state: :accepted) }
@@ -535,7 +535,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status adds a verifiable quote', feature: :inbound_quotes do
context 'when the status adds a verifiable quote' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }
let(:approval_uri) { 'https://quoted.example.com/approvals/1' }
@@ -600,7 +600,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status adds a unverifiable quote', feature: :inbound_quotes do
context 'when the status adds a unverifiable quote' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }
let(:approval_uri) { 'https://quoted.example.com/approvals/1' }
@@ -635,7 +635,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status removes a verified quote', feature: :inbound_quotes do
context 'when the status removes a verified quote' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }
let!(:quote) { Fabricate(:quote, status: status, quoted_status: quoted_status, approval_uri: approval_uri, state: :accepted) }
@@ -660,7 +660,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status removes an unverified quote', feature: :inbound_quotes do
context 'when the status removes an unverified quote' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }
let!(:quote) { Fabricate(:quote, status: status, quoted_status: quoted_status, approval_uri: nil, state: :pending) }
@@ -684,7 +684,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status swaps a verified quote with an unverifiable quote', feature: :inbound_quotes do
context 'when the status swaps a verified quote with an unverifiable quote' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }
let(:second_quoted_status) { Fabricate(:status, account: quoted_account) }
@@ -752,7 +752,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status swaps a verified quote with another verifiable quote', feature: :inbound_quotes do
context 'when the status swaps a verified quote with another verifiable quote' do
let(:quoted_account) { Fabricate(:account, domain: 'quoted.example.com') }
let(:second_quoted_account) { Fabricate(:account, domain: 'second-quoted.example.com') }
let(:quoted_status) { Fabricate(:status, account: quoted_account) }