|
|
|
|
@ -343,6 +343,42 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when originally without media attachments and text is removed' do
|
|
|
|
|
before do
|
|
|
|
|
stub_request(:get, 'https://example.com/foo.png').to_return(body: attachment_fixture('emojo.png'))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
let(:payload) do
|
|
|
|
|
{
|
|
|
|
|
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
|
|
|
id: 'foo',
|
|
|
|
|
type: 'Note',
|
|
|
|
|
content: '',
|
|
|
|
|
updated: '2021-09-08T22:39:25Z',
|
|
|
|
|
attachment: [
|
|
|
|
|
{ type: 'Image', mediaType: 'image/png', url: 'https://example.com/foo.png' },
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'updates media attachments, fetches attachment, records media and text removal in edit' do
|
|
|
|
|
subject.call(status, json, json)
|
|
|
|
|
|
|
|
|
|
expect(status.reload.ordered_media_attachments.first)
|
|
|
|
|
.to be_present
|
|
|
|
|
.and(have_attributes(remote_url: 'https://example.com/foo.png'))
|
|
|
|
|
|
|
|
|
|
expect(a_request(:get, 'https://example.com/foo.png'))
|
|
|
|
|
.to have_been_made
|
|
|
|
|
|
|
|
|
|
expect(status.edits.reload.last.ordered_media_attachment_ids)
|
|
|
|
|
.to_not be_empty
|
|
|
|
|
|
|
|
|
|
expect(status.edits.reload.last.text)
|
|
|
|
|
.to_not be_present
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context 'when originally with media attachments' do
|
|
|
|
|
let(:media_attachments) { [Fabricate(:media_attachment, remote_url: 'https://example.com/foo.png'), Fabricate(:media_attachment, remote_url: 'https://example.com/unused.png')] }
|
|
|
|
|
|
|
|
|
|
|