Fix: 既知の投稿の参照・引用が認識されない問題 (#320)

This commit is contained in:
KMY(雪あすか) 2023-11-30 17:39:04 +09:00 committed by GitHub
parent 87bd76453a
commit 39446f1357
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 0 deletions

View file

@ -33,6 +33,8 @@ class ActivityPub::Activity::Update < ActivityPub::Activity
ActivityPub::ProcessStatusUpdateService.new.call(@status, @json, @object, request_id: @options[:request_id])
forward_for_conversation
@status
end
def forward_for_conversation

View file

@ -241,6 +241,37 @@ RSpec.describe ProcessReferencesService, type: :service do
end
end
end
context 'when already fetched remote post' do
let(:account) { Fabricate(:account, followers_url: 'http://example.com/followers', domain: 'example.com', uri: 'https://example.com/actor') }
let!(:remote_status) { Fabricate(:status, account: account, uri: 'https://example.com/test_post', url: 'https://example.com/test_post', text: 'Lorem ipsum') }
let(:object_json) do
{
id: 'https://example.com/test_post',
to: ActivityPub::TagManager::COLLECTIONS[:public],
'@context': ActivityPub::TagManager::CONTEXT,
type: 'Note',
actor: account.uri,
attributedTo: account.uri,
content: 'Lorem ipsum',
}
end
let(:text) { 'BT:https://example.com/test_post' }
before do
stub_request(:get, 'https://example.com/test_post').to_return(status: 200, body: Oj.dump(object_json), headers: { 'Content-Type' => 'application/activity+json' })
end
it 'reference it' do
expect(subject.size).to eq 1
expect(subject[0][1]).to eq 'BT'
status = Status.find_by(id: subject[0][0])
expect(status).to_not be_nil
expect(status.id).to eq remote_status.id
expect(status.url).to eq 'https://example.com/test_post'
end
end
end
describe 'editing new status' do