@ -733,6 +733,72 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
end
end
context 'when the status adds a verifiable quote of a reblog through an explicit update' do
let ( :quoted_account ) { Fabricate ( :account , domain : 'quoted.example.com' ) }
let ( :quoted_status ) { Fabricate ( :status , account : quoted_account , reblog : Fabricate ( :status ) ) }
let ( :approval_uri ) { 'https://quoted.example.com/approvals/1' }
let ( :payload ) do
{
'@context' : [
'https://www.w3.org/ns/activitystreams' ,
{
'@id' : 'https://w3id.org/fep/044f#quote' ,
'@type' : '@id' ,
} ,
{
'@id' : 'https://w3id.org/fep/044f#quoteAuthorization' ,
'@type' : '@id' ,
} ,
] ,
id : 'foo' ,
type : 'Note' ,
summary : 'Show more' ,
content : 'Hello universe' ,
updated : '2021-09-08T22:39:25Z' ,
quote : ActivityPub :: TagManager . instance . uri_for ( quoted_status ) ,
quoteAuthorization : approval_uri ,
}
end
before do
stub_request ( :get , approval_uri ) . to_return ( headers : { 'Content-Type' : 'application/activity+json' } , body : Oj . dump ( {
'@context' : [
'https://www.w3.org/ns/activitystreams' ,
{
QuoteAuthorization : 'https://w3id.org/fep/044f#QuoteAuthorization' ,
gts : 'https://gotosocial.org/ns#' ,
interactionPolicy : {
'@id' : 'gts:interactionPolicy' ,
'@type' : '@id' ,
} ,
interactingObject : {
'@id' : 'gts:interactingObject' ,
'@type' : '@id' ,
} ,
interactionTarget : {
'@id' : 'gts:interactionTarget' ,
'@type' : '@id' ,
} ,
} ,
] ,
type : 'QuoteAuthorization' ,
id : approval_uri ,
attributedTo : ActivityPub :: TagManager . instance . uri_for ( quoted_status . account ) ,
interactingObject : ActivityPub :: TagManager . instance . uri_for ( status ) ,
interactionTarget : ActivityPub :: TagManager . instance . uri_for ( quoted_status ) ,
} ) )
end
it 'updates the approval URI but does not verify the quote' do
expect { subject . call ( status , json , json ) }
. to change ( status , :quote ) . from ( nil )
expect ( status . quote . approval_uri ) . to eq approval_uri
expect ( status . quote . state ) . to_not eq 'accepted'
expect ( status . quote . quoted_status ) . to be_nil
end
end
context 'when the status adds a unverifiable quote through an implicit update' do
let ( :quoted_account ) { Fabricate ( :account , domain : 'quoted.example.com' ) }
let ( :quoted_status ) { Fabricate ( :status , account : quoted_account ) }