Ensure follow reject/accept object IDs are strings to avoid JsonLD normalize errors in ActivityPub\Transmitter

This commit is contained in:
Hypolite Petovan 2019-05-19 18:44:57 -04:00
parent 3114754f4b
commit 10dfe4347b

View file

@ -1538,13 +1538,16 @@ class Transmitter
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => System::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Accept', 'type' => 'Accept',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => ['id' => $id, 'type' => 'Follow', 'object' => [
'id' => (string)$id,
'type' => 'Follow',
'actor' => $profile['url'], 'actor' => $profile['url'],
'object' => $owner['url']], 'object' => $owner['url']
],
'instrument' => self::getService(), 'instrument' => self::getService(),
'to' => [$profile['url']]]; 'to' => [$profile['url']]];
Logger::log('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG); Logger::debug('Sending accept to ' . $target . ' for user ' . $uid . ' with id ' . $id);
$signed = LDSignature::sign($data, $owner); $signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);
@ -1568,13 +1571,16 @@ class Transmitter
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => System::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Reject', 'type' => 'Reject',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => ['id' => $id, 'type' => 'Follow', 'object' => [
'id' => (string)$id,
'type' => 'Follow',
'actor' => $profile['url'], 'actor' => $profile['url'],
'object' => $owner['url']], 'object' => $owner['url']
],
'instrument' => self::getService(), 'instrument' => self::getService(),
'to' => [$profile['url']]]; 'to' => [$profile['url']]];
Logger::log('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG); Logger::debug('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id);
$signed = LDSignature::sign($data, $owner); $signed = LDSignature::sign($data, $owner);
HTTPSignature::transmit($signed, $profile['inbox'], $uid); HTTPSignature::transmit($signed, $profile['inbox'], $uid);