diff --git a/spec/lib/activitypub/activity/accept_spec.rb b/spec/lib/activitypub/activity/accept_spec.rb index 2797fd2146d526..24dbcbff7cbb5e 100644 --- a/spec/lib/activitypub/activity/accept_spec.rb +++ b/spec/lib/activitypub/activity/accept_spec.rb @@ -132,5 +132,12 @@ expect(friend.reload.they_are_idle?).to be true expect(friend.i_am_accepted?).to be true end + + it 'when my server is not pending' do + friend.update(active_state: :idle) + subject.perform + expect(friend.reload.i_am_idle?).to be true + expect(friend.they_are_idle?).to be true + end end end diff --git a/spec/lib/status_reach_finder_spec.rb b/spec/lib/status_reach_finder_spec.rb index 4b77a1ae99a006..2d8e075d5b2f51 100644 --- a/spec/lib/status_reach_finder_spec.rb +++ b/spec/lib/status_reach_finder_spec.rb @@ -114,7 +114,7 @@ context 'with follower' do before do - Fabricate(:friend_domain, domain: 'foo.bar', active_state: :accepted) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', active_state: :accepted) bob.follow!(alice) end @@ -126,7 +126,7 @@ context 'with follower but not local-distributable' do before do - Fabricate(:friend_domain, domain: 'foo.bar', active_state: :accepted, delivery_local: false) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', active_state: :accepted, delivery_local: false) bob.follow!(alice) end @@ -136,9 +136,9 @@ end end - context 'with non-follower' do + context 'with non-follower and non-relay' do before do - Fabricate(:friend_domain, domain: 'foo.bar', active_state: :accepted) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', active_state: :accepted) end it 'send status' do @@ -149,7 +149,7 @@ context 'with pending' do before do - Fabricate(:friend_domain, domain: 'foo.bar', active_state: :pending) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', active_state: :pending) bob.follow!(alice) end @@ -161,7 +161,7 @@ context 'with unidirection from them' do before do - Fabricate(:friend_domain, domain: 'foo.bar', active_state: :idle, passive_state: :accepted) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', active_state: :idle, passive_state: :accepted) bob.follow!(alice) end @@ -173,7 +173,7 @@ context 'when unavailable' do before do - Fabricate(:friend_domain, domain: 'foo.bar', active_state: :accepted, available: false) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', active_state: :accepted, available: false) bob.follow!(alice) end @@ -185,8 +185,7 @@ context 'when distributable' do before do - Fabricate(:friend_domain, domain: 'foo.bar', passive_state: :accepted, pseudo_relay: true) - bob.follow!(alice) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', passive_state: :accepted, pseudo_relay: true) end it 'send status' do @@ -195,9 +194,9 @@ end end - context 'when distributable, following reverse' do + context 'when distributable and following' do before do - Fabricate(:friend_domain, domain: 'foo.bar', active_state: :accepted, pseudo_relay: true) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', passive_state: :accepted, pseudo_relay: true) bob.follow!(alice) end @@ -207,10 +206,20 @@ end end + context 'when distributable reverse' do + before do + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', active_state: :accepted, pseudo_relay: true) + end + + it 'send status' do + expect(subject.inboxes).to_not include 'https://foo.bar/inbox' + expect(subject.inboxes_for_friend).to include 'https://foo.bar/inbox' + end + end + context 'when distributable but not local distributable' do before do - Fabricate(:friend_domain, domain: 'foo.bar', passive_state: :accepted, pseudo_relay: true, delivery_local: false) - bob.follow!(alice) + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', passive_state: :accepted, pseudo_relay: true, delivery_local: false) end it 'send status' do @@ -219,20 +228,23 @@ end end - context 'when distributable and not following' do + context 'when distributable and following but not local distributable' do before do - Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', active_state: :accepted, pseudo_relay: true) + Fabricate(:friend_domain, domain: 'foo.bar', passive_state: :accepted, pseudo_relay: true, delivery_local: false) + bob.follow!(alice) end it 'send status' do - expect(subject.inboxes).to_not include 'https://foo.bar/inbox' - expect(subject.inboxes_for_friend).to include 'https://foo.bar/inbox' + expect(subject.inboxes).to include 'https://foo.bar/inbox' + expect(subject.inboxes_for_friend).to_not include 'https://foo.bar/inbox' end end end context 'when it contains distributable friend server' do - before { Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', available: true, passive_state: :accepted, pseudo_relay: true) } + before do + Fabricate(:friend_domain, domain: 'foo.bar', inbox_url: 'https://foo.bar/inbox', passive_state: :accepted, pseudo_relay: true) + end it 'includes the inbox of the mentioned account' do expect(subject.inboxes).to_not include 'https://foo.bar/inbox'