1
0
Fork 0
forked from gitea/nas

Remove: kmyblue独自機能の引用

This commit is contained in:
KMY 2025-04-24 08:48:28 +09:00
parent 620a895184
commit d845d1e9fb
70 changed files with 812 additions and 1788 deletions

View file

@ -1711,104 +1711,10 @@ RSpec.describe ActivityPub::Activity::Create do
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.quote).to be_nil
expect(status.references.pluck(:id)).to eq [target_status.id]
end
end
context 'with quote' do
let(:recipient) { Fabricate(:account) }
let!(:target_status) { Fabricate(:status, account: Fabricate(:account, domain: nil)) }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
quote: ActivityPub::TagManager.instance.uri_for(target_status),
}
end
it 'creates status' do
expect { subject.perform }.to change(sender.statuses, :count).by(1)
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.references.pluck(:id)).to eq [target_status.id]
expect(status.quote).to_not be_nil
expect(status.quote.id).to eq target_status.id
end
end
context 'with quote as feb-e232 object links' do
let(:recipient) { Fabricate(:account) }
let!(:target_status) { Fabricate(:status, account: Fabricate(:account, domain: nil)) }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
tag: [
{
type: 'Link',
mediaType: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
href: ActivityPub::TagManager.instance.uri_for(target_status),
},
],
}
end
it 'creates status' do
expect { subject.perform }.to change(sender.statuses, :count).by(1)
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.references.pluck(:id)).to eq [target_status.id]
expect(status.quote).to_not be_nil
expect(status.quote.id).to eq target_status.id
end
end
context 'with references and quote' do
let(:recipient) { Fabricate(:account) }
let!(:target_status) { Fabricate(:status, account: Fabricate(:account, domain: nil)) }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
quote: ActivityPub::TagManager.instance.uri_for(target_status),
references: {
id: 'target_status',
type: 'Collection',
first: {
type: 'CollectionPage',
next: nil,
partOf: 'target_status',
items: [
ActivityPub::TagManager.instance.uri_for(target_status),
],
},
},
}
end
it 'creates status' do
expect { subject.perform }.to change(sender.statuses, :count).by(1)
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.references.pluck(:id)).to eq [target_status.id]
expect(status.quote).to_not be_nil
expect(status.quote.id).to eq target_status.id
end
end
context 'with language' do
let(:to) { 'https://www.w3.org/ns/activitystreams#Public' }
let(:object_json) do
@ -2556,53 +2462,6 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
context 'when sender quotes to local status' do
subject { described_class.new(json, sender, delivery: true) }
let!(:local_status) { Fabricate(:status) }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
quote: ActivityPub::TagManager.instance.uri_for(local_status),
}
end
before do
subject.perform
end
it 'creates status' do
status = sender.statuses.first
expect(status).to_not be_nil
expect(status.text).to eq 'Lorem ipsum'
end
end
context 'when sender quotes to non-local status' do
subject { described_class.new(json, sender, delivery: true) }
let!(:remote_status) { Fabricate(:status, uri: 'https://foo.bar/among', account: Fabricate(:account, domain: 'foo.bar', uri: 'https://foo.bar/account')) }
let(:object_json) do
{
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
type: 'Note',
content: 'Lorem ipsum',
quote: ActivityPub::TagManager.instance.uri_for(remote_status),
}
end
before do
subject.perform
end
it 'creates status' do
expect(sender.statuses.count).to eq 0
end
end
context 'when sender targets a local user' do
subject { described_class.new(json, sender, delivery: true) }