1
0
Fork 0
forked from gitea/nas

Fix multiple issues in quoted posts hydration (#34864)

This commit is contained in:
Claire 2025-05-31 17:20:31 +02:00 committed by GitHub
parent 44d71d59ef
commit 32b521b7f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 67 additions and 16 deletions

View file

@ -50,6 +50,7 @@ RSpec.describe StatusCacheHydrator do
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_status]).to be_nil
end
end
@ -65,6 +66,48 @@ RSpec.describe StatusCacheHydrator do
expect(subject[:quote]).to_not be_nil
end
context 'when the quote post is recursive' do
let(:quoted_status) { status }
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 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
end
end
context 'when the quoted post author has blocked the viewer' do
before do
quoted_status.account.block!(account)
end
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
end
end
context 'when the viewer has blocked the quoted post author' do
before do
account.block!(quoted_status.account)
end
it 'returns 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 has been favourited' do
before do
FavouriteService.new.call(account, quoted_status)