Fix Undo Announce activity is not sent, when not followed by the reblogged post author (#18482)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
		
							parent
							
								
									a12b7551cf
								
							
						
					
					
						commit
						0a01bc01d2
					
				
					 5 changed files with 44 additions and 26 deletions
				
			
		|  | @ -112,6 +112,14 @@ RSpec.describe ActivityPub::TagManager do | |||
|       expect(subject.cc(status)).to include(subject.uri_for(foo)) | ||||
|       expect(subject.cc(status)).to_not include(subject.uri_for(alice)) | ||||
|     end | ||||
| 
 | ||||
|     it 'returns poster of reblogged post, if reblog' do | ||||
|       bob    = Fabricate(:account, username: 'bob', domain: 'example.com', inbox_url: 'http://example.com/bob') | ||||
|       alice  = Fabricate(:account, username: 'alice') | ||||
|       status = Fabricate(:status, visibility: :public, account: bob) | ||||
|       reblog = Fabricate(:status, visibility: :public, account: alice, reblog: status) | ||||
|       expect(subject.cc(reblog)).to include(subject.uri_for(bob)) | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   describe '#local_uri?' do | ||||
|  |  | |||
|  | @ -86,9 +86,5 @@ RSpec.describe ReblogService, type: :service do | |||
|     it 'distributes to followers' do | ||||
|       expect(ActivityPub::DistributionWorker).to have_received(:perform_async) | ||||
|     end | ||||
| 
 | ||||
|     it 'sends an announce activity to the author' do | ||||
|       expect(a_request(:post, bob.inbox_url)).to have_been_made.once | ||||
|     end | ||||
|   end | ||||
| end | ||||
|  |  | |||
|  | @ -110,4 +110,22 @@ RSpec.describe RemoveStatusService, type: :service do | |||
|              )).to have_been_made.once | ||||
|     end | ||||
|   end | ||||
| 
 | ||||
|   context 'when removed status is a reblog of a non-follower' do | ||||
|     let!(:original_status) { Fabricate(:status, account: bill, text: 'Hello ThisIsASecret', visibility: :public) } | ||||
|     let!(:status) { ReblogService.new.call(alice, original_status) } | ||||
| 
 | ||||
|     it 'sends Undo activity to followers' do | ||||
|       subject.call(status) | ||||
|       expect(a_request(:post, bill.inbox_url).with( | ||||
|                body: hash_including({ | ||||
|                  'type' => 'Undo', | ||||
|                  'object' => hash_including({ | ||||
|                    'type' => 'Announce', | ||||
|                    'object' => ActivityPub::TagManager.instance.uri_for(original_status), | ||||
|                  }), | ||||
|                }) | ||||
|              )).to have_been_made.once | ||||
|     end | ||||
|   end | ||||
| end | ||||
|  |  | |||
		Reference in a new issue