$networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
}
- $condition = ['uid' => $uid, 'archive' => false, 'pending' => false, 'blocked' => false, 'network' => Protocol::FEDERATED];
+ $condition = [
+ 'uid' => $uid,
+ 'archive' => false,
+ 'pending' => false,
+ 'blocked' => false,
+ 'network' => Protocol::FEDERATED,
+ ];
if (!empty($uid)) {
$condition['rel'] = [Contact::FOLLOWER, Contact::FRIEND];
*
* @param integer $item_id Item id
* @param boolean $force Force new cache entry
- * @return array with the activity
+ * @return array|false activity or false on failure
* @throws \Exception
*/
- public static function createCachedActivityFromItem(int $item_id, bool $force = false): array
+ public static function createCachedActivityFromItem(int $item_id, bool $force = false)
{
$cachekey = 'APDelivery:createActivity:' . $item_id;
}
if ($type == 'Delete') {
- $data['id'] = Item::newURI($item['uid'], $item['guid']) . '/' . $type;;
+ $data['id'] = Item::newURI($item['guid']) . '/' . $type;;
} elseif (($item['gravity'] == GRAVITY_ACTIVITY) && ($type != 'Undo')) {
$data['id'] = $item['uri'];
} else {
* Transmit a message that the contact request had been accepted
*
* @param string $target Target profile
- * @param integer $id Object id
+ * @param string $id Object id
* @param integer $uid User ID
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function sendContactAccept(string $target, int $id, int $uid)
+ public static function sendContactAccept(string $target, string $id, int $uid)
{
$profile = APContact::getByURL($target);
if (empty($profile['inbox'])) {
'type' => 'Accept',
'actor' => $owner['url'],
'object' => [
- 'id' => (string)$id,
+ 'id' => $id,
'type' => 'Follow',
'actor' => $profile['url'],
'object' => $owner['url']
/**
* Reject a contact request or terminates the contact relation
*
- * @param string $target Target profile
- * @param integer $id Object id
- * @param integer $uid User ID
+ * @param string $target Target profile
+ * @param string $objectId Object id
+ * @param int $uid User ID
* @return bool Operation success
* @throws HTTPException\InternalServerErrorException
* @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);
if (empty($profile['inbox'])) {
'@context' => ActivityPub::CONTEXT,
'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Reject',
- 'actor' => $owner['url'],
+ 'actor' => $owner['url'],
'object' => [
- 'id' => (string)$id,
+ 'id' => $objectId,
'type' => 'Follow',
'actor' => $profile['url'],
'object' => $owner['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);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
return false;
}
- $id = DI::baseUrl() . '/activity/' . System::createGUID();
+ $objectId = DI::baseUrl() . '/activity/' . System::createGUID();
$owner = User::getOwnerDataById($uid);
$data = [
'@context' => ActivityPub::CONTEXT,
- 'id' => $id,
+ 'id' => $objectId,
'type' => 'Undo',
'actor' => $owner['url'],
'object' => [
'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);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
* Prepends mentions (@) to $body variable
*
* @param string $body HTML code
- * @param int $uriid URI id
+ * @param int $uriId
* @param string $authorLink Author link
* @return string HTML code with prepended mentions
*/