Change: 単方向の承認だけでフレンドサーバーが有効になるようにする (#74)
* Test: テストを先に作成 * Fix: テスト不備 * Wip: フレンドサーバーのテストを修正 * Wip: エラーを修正 * 項目のラベリングを修正 * 新しい設定が変更できないのを修正 * Wip: 削除時の処理を修正 * フレンド自動承認設定を削除 * Fix: 申請を受けたドメインのINBOXが空になる問題 * Change: #75 フレンドでないサーバーからのローカル公開を未収載に変換 (#77)
This commit is contained in:
parent
521932c802
commit
1eb2d78b5d
24 changed files with 314 additions and 126 deletions
|
@ -30,9 +30,11 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
|
||||
let(:sender_software) { 'mastodon' }
|
||||
let(:custom_before) { false }
|
||||
let(:active_friend) { false }
|
||||
|
||||
before do
|
||||
Fabricate(:instance_info, domain: 'example.com', software: sender_software)
|
||||
Fabricate(:friend_domain, domain: 'example.com', active_state: :accepted) if active_friend
|
||||
subject.perform unless custom_before
|
||||
end
|
||||
|
||||
|
@ -245,6 +247,26 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
}
|
||||
end
|
||||
|
||||
it 'creates status' do
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.visibility).to eq 'unlisted'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when public_unlisted with LocalPublic from friend-server' do
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
type: 'Note',
|
||||
content: 'Lorem ipsum',
|
||||
to: ['http://example.com/followers', 'LocalPublic'],
|
||||
cc: 'https://www.w3.org/ns/activitystreams#Public',
|
||||
}
|
||||
end
|
||||
let(:active_friend) { true }
|
||||
|
||||
it 'creates status' do
|
||||
status = sender.statuses.first
|
||||
|
||||
|
@ -433,6 +455,18 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
context 'with public_unlisted with LocalPublic' do
|
||||
let(:searchable_by) { ['http://example.com/followers', 'LocalPublic'] }
|
||||
|
||||
it 'create status' do
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.searchability).to eq 'private'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with public_unlisted with LocalPublic from friend-server' do
|
||||
let(:searchable_by) { ['http://example.com/followers', 'LocalPublic'] }
|
||||
let(:active_friend) { true }
|
||||
|
||||
it 'create status' do
|
||||
status = sender.statuses.first
|
||||
|
||||
|
@ -1506,11 +1540,7 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
context 'when sender is in friend server' do
|
||||
subject { described_class.new(json, sender, delivery: true) }
|
||||
|
||||
before do
|
||||
Fabricate(:friend_domain, domain: sender.domain, active_state: :accepted, passive_state: :accepted)
|
||||
subject.perform
|
||||
end
|
||||
|
||||
let!(:friend) { Fabricate(:friend_domain, domain: sender.domain, active_state: :accepted) }
|
||||
let(:object_json) do
|
||||
{
|
||||
id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
|
||||
|
@ -1520,11 +1550,20 @@ RSpec.describe ActivityPub::Activity::Create do
|
|||
end
|
||||
|
||||
it 'creates status' do
|
||||
subject.perform
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to_not be_nil
|
||||
expect(status.text).to eq 'Lorem ipsum'
|
||||
end
|
||||
|
||||
it 'whey no-relay not creates status' do
|
||||
friend.update(allow_all_posts: false)
|
||||
subject.perform
|
||||
status = sender.statuses.first
|
||||
|
||||
expect(status).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the sender has no relevance to local activity' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue