$activity_id = ActivityPub\Transmitter::activityIDFromContact($contact['id']);
$success = ActivityPub\Transmitter::sendActivity('Follow', $url, 0, $activity_id);
if ($success) {
- DBA::update('contact', ['rel' => Contact::FRIEND], ['id' => $contact['id']]);
+ Contact::update(['rel' => Contact::FRIEND], ['id' => $contact['id']]);
}
return $success;
$success = self::sendContactUndo($url, $contact['id'], 0);
if ($success || $force) {
- DBA::update('contact', ['rel' => Contact::NOTHING], ['id' => $contact['id']]);
+ Contact::update(['rel' => Contact::NOTHING], ['id' => $contact['id']]);
}
return $success;
'owner' => $owner['url'],
'publicKeyPem' => $owner['pubkey']];
$data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox'];
- $data['icon'] = ['type' => 'Image', 'url' => Contact::getAvatarUrlForId($owner['id'], '', $owner['updated'])];
+ $data['icon'] = ['type' => 'Image', 'url' => User::getAvatarUrl($owner)];
$resourceid = Photo::ridFromURI($owner['photo']);
if (!empty($resourceid)) {
$custom_fields = [];
- foreach (DI::profileField()->selectByContactId(0, 1) as $profile_field) {
+ foreach (DI::profileField()->selectByContactId(0, $uid) as $profile_field) {
$custom_fields[] = [
'type' => 'PropertyValue',
'name' => $profile_field->label,
$event = [];
$event['name'] = $item['event-summary'];
$event['content'] = BBCode::convertForUriId($item['uri-id'], $item['event-desc'], BBCode::ACTIVITYPUB);
- $event['startTime'] = DateTimeFormat::utc($item['event-start'] . '+00:00', DateTimeFormat::ATOM);
+ $event['startTime'] = DateTimeFormat::utc($item['event-start'], 'c');
if (!$item['event-nofinish']) {
- $event['endTime'] = DateTimeFormat::utc($item['event-finish'] . '+00:00', DateTimeFormat::ATOM);
+ $event['endTime'] = DateTimeFormat::utc($item['event-finish'], 'c');
}
if (!empty($item['event-location'])) {
$event['location'] = self::createLocation($item);
}
- $event['dfrn:adjust'] = (bool)$item['event-adjust'];
+ // 2021.12: Backward compatibility value, all the events now "adjust" to the viewer timezone
+ $event['dfrn:adjust'] = true;
return $event;
}
* @param string $target Target profile
* @param $id
* @param integer $uid User ID
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ * @return bool Operation success
+ * @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function sendContactReject($target, $id, $uid)
+ public static function sendContactReject($target, $id, $uid): bool
{
$profile = APContact::getByURL($target);
if (empty($profile['inbox'])) {
Logger::warning('No inbox found for target', ['target' => $target, 'profile' => $profile]);
- return;
+ return false;
}
$owner = User::getOwnerDataById($uid);
Logger::debug('Sending reject to ' . $target . ' for user ' . $uid . ' with id ' . $id);
$signed = LDSignature::sign($data, $owner);
- HTTPSignature::transmit($signed, $profile['inbox'], $uid);
+ return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
}
/**