Add: Webでの引用表示 (#50)
* Add compacted component * 引用表示の間にコンテナをはさみ、不要なコードを削除 * 引用APIを作成、ついでにブロック状況を引用APIに反映 * テスト修正など * 引用をキャッシュに登録 * `quote_id`が`quote_of_id`になったのをSerializerに反映 * Fix test * 引用をフィルターの対象に含める設定+エラー修正 * ストリーミングの存在しないプロパティ削除によるエラーを修正 * Fix lint * 他のサーバーから来た引用付き投稿を処理 * Fix test * フィルター設定時エラーの調整 * 画像つき投稿のスタイルを調整 * 画像つき投稿の最大高さを調整 * 引用禁止・非表示の設定を追加 * ブロック対応 * マイグレーションコード調整 * 引用設定の翻訳を作成 * Lint修正 * 参照1つの場合は引用に変換する設定を削除 * 不要になったテストを削除 * ブロック設定追加、バグ修正 * 他サーバーへ引用送信・受け入れ
This commit is contained in:
parent
3c649aa74d
commit
44b739a39a
53 changed files with 1362 additions and 120 deletions
|
@ -1089,6 +1089,97 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with references' 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',
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
@ -1274,6 +1365,53 @@ 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) }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue