> TypeError: "Argument 2 passed to Friendica\Protocol\ActivityPub\Transmitter::sendContactReject()
> must be of the type int, string given

I followed here here the documentation, may fix #11708
This commit is contained in:
Roland Häder 2022-07-06 05:41:48 +02:00
parent 7b55f93027
commit bf809c9d57
No known key found for this signature in database
GPG Key ID: C82EDE5DDFA0BA77

View File

@ -2161,14 +2161,14 @@ class Transmitter
/** /**
* Reject a contact request or terminates the contact relation * Reject a contact request or terminates the contact relation
* *
* @param string $target Target profile * @param string $target Target profile
* @param integer $id Object id * @param string $objectId Object id
* @param integer $uid User ID * @param int $uid User ID
* @return bool Operation success * @return bool Operation success
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
*/ */
public static function sendContactReject(string $target, int $id, int $uid): bool public static function sendContactReject(string $target, string $objectId, int $uid): bool
{ {
$profile = APContact::getByURL($target); $profile = APContact::getByURL($target);
if (empty($profile['inbox'])) { if (empty($profile['inbox'])) {
@ -2181,9 +2181,9 @@ class Transmitter
'@context' => ActivityPub::CONTEXT, '@context' => ActivityPub::CONTEXT,
'id' => DI::baseUrl() . '/activity/' . System::createGUID(), 'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Reject', 'type' => 'Reject',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => [ 'object' => [
'id' => (string)$id, 'id' => $objectId,
'type' => 'Follow', 'type' => 'Follow',
'actor' => $profile['url'], 'actor' => $profile['url'],
'object' => $owner['url'] 'object' => $owner['url']
@ -2192,7 +2192,7 @@ class Transmitter
'to' => [$profile['url']], 'to' => [$profile['url']],
]; ];
Logger::debug('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id); Logger::debug('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $objectId);
$signed = LDSignature::sign($data, $owner); $signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid); return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
@ -2222,12 +2222,12 @@ class Transmitter
return false; return false;
} }
$id = DI::baseUrl() . '/activity/' . System::createGUID(); $objectId = DI::baseUrl() . '/activity/' . System::createGUID();
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
$data = [ $data = [
'@context' => ActivityPub::CONTEXT, '@context' => ActivityPub::CONTEXT,
'id' => $id, 'id' => $objectId,
'type' => 'Undo', 'type' => 'Undo',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => [ 'object' => [
@ -2240,7 +2240,7 @@ class Transmitter
'to' => [$profile['url']], 'to' => [$profile['url']],
]; ];
Logger::info('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id); Logger::info('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $objectId);
$signed = LDSignature::sign($data, $owner); $signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid); return HTTPSignature::transmit($signed, $profile['inbox'], $uid);