1
0
Fork 0
forked from gitea/nas

Change: 単方向の承認だけでフレンドサーバーが有効になるようにする (#74)

* Test: テストを先に作成

* Fix: テスト不備

* Wip: フレンドサーバーのテストを修正

* Wip: エラーを修正

* 項目のラベリングを修正

* 新しい設定が変更できないのを修正

* Wip: 削除時の処理を修正

* フレンド自動承認設定を削除

* Fix: 申請を受けたドメインのINBOXが空になる問題

* Change: #75 フレンドでないサーバーからのローカル公開を未収載に変換 (#77)
This commit is contained in:
KMY(雪あすか) 2023-10-10 21:46:26 +09:00 committed by GitHub
parent 521932c802
commit 1eb2d78b5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 314 additions and 126 deletions

View file

@ -11,9 +11,11 @@ describe FriendDomain do
describe '#follow!' do
it 'call inbox' do
friend.update(active_state: :accepted, passive_state: :accepted)
friend.follow!
expect(friend.active_follow_activity_id).to_not be_nil
expect(friend.i_am_pending?).to be true
expect(friend.they_are_idle?).to be true
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
id: friend.active_follow_activity_id,
type: 'Follow',
@ -25,10 +27,11 @@ describe FriendDomain do
describe '#unfollow!' do
it 'call inbox' do
friend.update(active_follow_activity_id: 'ohagi')
friend.update(active_follow_activity_id: 'ohagi', active_state: :accepted, passive_state: :accepted)
friend.unfollow!
expect(friend.active_follow_activity_id).to be_nil
expect(friend.i_am_idle?).to be true
expect(friend.they_are_idle?).to be true
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
type: 'Undo',
object: {
@ -43,9 +46,10 @@ describe FriendDomain do
describe '#accept!' do
it 'call inbox' do
friend.update(passive_follow_activity_id: 'ohagi', passive_state: :pending)
friend.update(passive_follow_activity_id: 'ohagi', active_state: :accepted, passive_state: :pending)
friend.accept!
expect(friend.they_are_accepted?).to be true
expect(friend.i_am_idle?).to be true
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
id: 'ohagi#accepts/friends',
type: 'Accept',
@ -57,9 +61,10 @@ describe FriendDomain do
describe '#reject!' do
it 'call inbox' do
friend.update(passive_follow_activity_id: 'ohagi', passive_state: :pending)
friend.update(passive_follow_activity_id: 'ohagi', active_state: :accepted, passive_state: :pending)
friend.reject!
expect(friend.they_are_rejected?).to be true
expect(friend.i_am_idle?).to be true
expect(a_request(:post, 'https://foo.bar/inbox').with(body: hash_including({
id: 'ohagi#rejects/friends',
type: 'Reject',