]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Transmitter.php
Replaced deprecated "log" function call
[friendica.git] / src / Protocol / ActivityPub / Transmitter.php
index 9b02ff0b9761c79453dbd25b572632d3d57df030..44b0463b033b4e73e799937ddd6d617cb77bb356 100644 (file)
@@ -23,8 +23,7 @@ namespace Friendica\Protocol\ActivityPub;
 
 use Friendica\Content\Feature;
 use Friendica\Content\Text\BBCode;
-use Friendica\Content\Text\Plaintext;
-use Friendica\Core\Cache\Duration;
+use Friendica\Core\Cache\Enum\Duration;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Core\System;
@@ -35,12 +34,12 @@ use Friendica\Model\Contact;
 use Friendica\Model\Conversation;
 use Friendica\Model\GServer;
 use Friendica\Model\Item;
-use Friendica\Model\ItemURI;
-use Friendica\Model\Profile;
 use Friendica\Model\Photo;
 use Friendica\Model\Post;
+use Friendica\Model\Profile;
 use Friendica\Model\Tag;
 use Friendica\Model\User;
+use Friendica\Network\HTTPException;
 use Friendica\Protocol\Activity;
 use Friendica\Protocol\ActivityPub;
 use Friendica\Protocol\Relay;
@@ -116,7 +115,7 @@ class Transmitter
                $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;
@@ -138,12 +137,12 @@ class Transmitter
 
                $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;
        }
-       
+
        /**
         * Collects a list of contacts of the given owner
         *
@@ -167,21 +166,17 @@ class Transmitter
                        'pending' => false,
                        'blocked' => false,
                ];
-               $condition = DBA::buildCondition($parameters);
 
-               $sql = "SELECT COUNT(*) as `count`
-                       FROM `contact`
-                       JOIN `apcontact` ON `apcontact`.`url` = `contact`.`url`
-                       " . $condition;
+               $condition = DBA::mergeConditions($parameters, ["`url` IN (SELECT `url` FROM `apcontact`)"]);
 
-               $contacts = DBA::fetchFirst($sql, ...$parameters);
+               $total = DBA::count('contact', $condition);
 
                $modulePath = '/' . $module . '/';
 
                $data = ['@context' => ActivityPub::CONTEXT];
                $data['id'] = DI::baseUrl() . $modulePath . $owner['nickname'];
                $data['type'] = 'OrderedCollection';
-               $data['totalItems'] = $contacts['count'];
+               $data['totalItems'] = $total;
 
                // When we hide our friends we will only show the pure number but don't allow more.
                $profile = Profile::getByUID($owner['uid']);
@@ -195,16 +190,7 @@ class Transmitter
                        $data['type'] = 'OrderedCollectionPage';
                        $list = [];
 
-                       $sql = "SELECT `contact`.`url`
-                               FROM `contact`
-                               JOIN `apcontact` ON `apcontact`.`url` = `contact`.`url`
-                               " . $condition . "
-                               LIMIT ?, ?";
-
-                       $parameters[] = ($page - 1) * 100;
-                       $parameters[] = 100;
-
-                       $contacts = DBA::p($sql, ...$parameters);
+                       $contacts = DBA::select('contact', ['url'], $condition, ['limit' => [($page - 1) * 100, 100]]);
                        while ($contact = DBA::fetch($contacts)) {
                                $list[] = $contact['url'];
                        }
@@ -235,26 +221,28 @@ class Transmitter
         */
        public static function getOutbox($owner, $page = null, $requester = '')
        {
-               $public_contact = Contact::getIdForURL($owner['url']);
-               $condition = ['uid' => 0, 'contact-id' => $public_contact,
-                       'private' => [Item::PUBLIC, Item::UNLISTED]];
+               $condition = ['private' => [Item::PUBLIC, Item::UNLISTED]];
 
                if (!empty($requester)) {
                        $requester_id = Contact::getIdForURL($requester, $owner['uid']);
                        if (!empty($requester_id)) {
                                $permissionSets = DI::permissionSet()->selectByContactId($requester_id, $owner['uid']);
                                if (!empty($permissionSets)) {
-                                       $condition = ['uid' => $owner['uid'], 'origin' => true,
-                                               'psid' => array_merge($permissionSets->column('id'),
-                                                       [DI::permissionSet()->getIdFromACL($owner['uid'], '', '', '', '')])];
+                                       $condition = ['psid' => array_merge($permissionSets->column('id'),
+                                                       [DI::permissionSet()->selectPublicForUser($owner['uid'])])];
                                }
                        }
                }
 
                $condition = array_merge($condition,
-                       ['author-id' => $public_contact,
-                       'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT],
-                       'deleted' => false, 'visible' => true]);
+                       ['uid'           => $owner['uid'],
+                       'author-id'      => Contact::getIdForURL($owner['url'], 0, false),
+                       'gravity'        => [GRAVITY_PARENT, GRAVITY_COMMENT],
+                       'network'        => Protocol::FEDERATED,
+                       'parent-network' => Protocol::FEDERATED,
+                       'origin'         => true,
+                       'deleted'        => false,
+                       'visible'        => true]);
 
                $count = Post::count($condition);
 
@@ -269,8 +257,6 @@ class Transmitter
                        $data['type'] = 'OrderedCollectionPage';
                        $list = [];
 
-                       $condition['parent-network'] = Protocol::NATIVE_SUPPORT;
-
                        $items = Post::select(['id'], $condition, ['limit' => [($page - 1) * 20, 20], 'order' => ['created' => true]]);
                        while ($item = Post::fetch($items)) {
                                $activity = self::createActivityFromItem($item['id'], true);
@@ -310,79 +296,70 @@ class Transmitter
        /**
         * Return the ActivityPub profile of the given user
         *
-        * @param integer $uid User ID
+        * @param int $uid User ID
         * @return array with profile data
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+        * @throws HTTPException\NotFoundException
+        * @throws HTTPException\InternalServerErrorException
         */
-       public static function getProfile($uid)
+       public static function getProfile(int $uid): array
        {
-               if ($uid != 0) {
-                       $condition = ['uid' => $uid, 'blocked' => false, 'account_expired' => false,
-                               'account_removed' => false, 'verified' => true];
-                       $fields = ['guid', 'nickname', 'pubkey', 'account-type', 'page-flags'];
-                       $user = DBA::selectFirst('user', $fields, $condition);
-                       if (!DBA::isResult($user)) {
-                               return [];
-                       }
-
-                       $fields = ['locality', 'region', 'country-name', 'net-publish'];
-                       $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid]);
-                       if (!DBA::isResult($profile)) {
-                               return [];
-                       }
-
-                       $fields = ['id', 'name', 'url', 'location', 'about', 'avatar', 'photo', 'updated'];
-                       $contact = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
-                       if (!DBA::isResult($contact)) {
-                               return [];
-                       }
-               } else {
-                       $contact = User::getSystemAccount();
-                       $user = ['guid' => '', 'nickname' => $contact['nick'], 'pubkey' => $contact['pubkey'],
-                               'account-type' => $contact['contact-type'], 'page-flags' => User::PAGE_FLAGS_NORMAL];
-                       $profile = ['locality' => '', 'region' => '', 'country-name' => '', 'net-publish' => false];
+               $owner = User::getOwnerDataById($uid);
+               if (!isset($owner['id'])) {
+                       DI::logger()->error('Unable to find owner data for uid', ['uid' => $uid, 'callstack' => System::callstack(20)]);
+                       throw new HTTPException\NotFoundException('User not found.');
                }
 
                $data = ['@context' => ActivityPub::CONTEXT];
-               $data['id'] = $contact['url'];
+               $data['id'] = $owner['url'];
 
-               if (!empty($user['guid'])) {
-                       $data['diaspora:guid'] = $user['guid'];
+               if (!empty($owner['guid'])) {
+                       $data['diaspora:guid'] = $owner['guid'];
                }
 
-               $data['type'] = ActivityPub::ACCOUNT_TYPES[$user['account-type']];
-               
+               $data['type'] = ActivityPub::ACCOUNT_TYPES[$owner['account-type']];
+
                if ($uid != 0) {
-                       $data['following'] = DI::baseUrl() . '/following/' . $user['nickname'];
-                       $data['followers'] = DI::baseUrl() . '/followers/' . $user['nickname'];
-                       $data['inbox'] = DI::baseUrl() . '/inbox/' . $user['nickname'];
-                       $data['outbox'] = DI::baseUrl() . '/outbox/' . $user['nickname'];
+                       $data['following'] = DI::baseUrl() . '/following/' . $owner['nick'];
+                       $data['followers'] = DI::baseUrl() . '/followers/' . $owner['nick'];
+                       $data['inbox'] = DI::baseUrl() . '/inbox/' . $owner['nick'];
+                       $data['outbox'] = DI::baseUrl() . '/outbox/' . $owner['nick'];
                } else {
                        $data['inbox'] = DI::baseUrl() . '/friendica/inbox';
                }
 
-               $data['preferredUsername'] = $user['nickname'];
-               $data['name'] = $contact['name'];
+               $data['preferredUsername'] = $owner['nick'];
+               $data['name'] = $owner['name'];
 
-               if (!empty($profile['country-name'] . $profile['region'] . $profile['locality'])) {
-                       $data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $profile['country-name'],
-                               'vcard:region' => $profile['region'], 'vcard:locality' => $profile['locality']];
+               if (!empty($owner['country-name'] . $owner['region'] . $owner['locality'])) {
+                       $data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'],
+                               'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']];
                }
 
-               if (!empty($contact['about'])) {
-                       $data['summary'] = BBCode::convert($contact['about'], false);
+               if (!empty($owner['about'])) {
+                       $data['summary'] = BBCode::convertForUriId($owner['uri-id'] ?? 0, $owner['about'], BBCode::EXTERNAL);
                }
 
-               $data['url'] = $contact['url'];
-               $data['manuallyApprovesFollowers'] = in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
-               $data['discoverable'] = $profile['net-publish'];
-               $data['publicKey'] = ['id' => $contact['url'] . '#main-key',
-                       'owner' => $contact['url'],
-                       'publicKeyPem' => $user['pubkey']];
+               if (!empty($owner['xmpp']) || !empty($owner['matrix'])) {
+                       $data['vcard:hasInstantMessage'] = [];
+
+                       if (!empty($owner['xmpp'])) {
+                               $data['vcard:hasInstantMessage'][] = 'xmpp:' . $owner['xmpp'];
+                       }
+                       if (!empty($owner['matrix'])) {
+                               $data['vcard:hasInstantMessage'][] = 'matrix:' . $owner['matrix'];
+                       }
+               }
+
+               $data['url'] = $owner['url'];
+               $data['manuallyApprovesFollowers'] = in_array($owner['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
+               $data['discoverable'] = (bool)$owner['net-publish'];
+               $data['publicKey'] = ['id' => $owner['url'] . '#main-key',
+                       'owner' => $owner['url'],
+                       'publicKeyPem' => $owner['pubkey']];
                $data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox'];
-               $data['icon'] = ['type' => 'Image', 'url' => Contact::getAvatarUrlForId($contact['id'], '', $contact['updated'])];
+               $data['icon'] = ['type' => 'Image', 'url' => User::getAvatarUrl($owner)];
 
-               $resourceid = Photo::ridFromURI($contact['photo']);
+               $resourceid = Photo::ridFromURI($owner['photo']);
                if (!empty($resourceid)) {
                        $photo = Photo::selectFirst(['type'], ["resource-id" => $resourceid]);
                        if (!empty($photo['type'])) {
@@ -390,10 +367,10 @@ class Transmitter
                        }
                }
 
-               if (!empty($contact['header'])) {
-                       $data['image'] = ['type' => 'Image', 'url' => Contact::getHeaderUrlForId($contact['id'], '', $contact['updated'])];
+               if (!empty($owner['header'])) {
+                       $data['image'] = ['type' => 'Image', 'url' => Contact::getHeaderUrlForId($owner['id'], '', $owner['updated'])];
 
-                       $resourceid = Photo::ridFromURI($contact['header']);
+                       $resourceid = Photo::ridFromURI($owner['header']);
                        if (!empty($resourceid)) {
                                $photo = Photo::selectFirst(['type'], ["resource-id" => $resourceid]);
                                if (!empty($photo['type'])) {
@@ -402,6 +379,20 @@ class Transmitter
                        }
                }
 
+               $custom_fields = [];
+
+               foreach (DI::profileField()->selectByContactId(0, $uid) as $profile_field) {
+                       $custom_fields[] = [
+                               'type' => 'PropertyValue',
+                               'name' => $profile_field->label,
+                               'value' => BBCode::convertForUriId($owner['uri-id'], $profile_field->value)
+                       ];
+               };
+
+               if (!empty($custom_fields)) {
+                       $data['attachment'] = $custom_fields;
+               }
+
                $data['generator'] = self::getService();
 
                // tags: https://kitty.town/@inmysocks/100656097926961126.json
@@ -720,10 +711,10 @@ class Transmitter
        /**
         * Check if a given contact should be delivered via AP
         *
-        * @param array $contact 
-        * @param array $networks 
-        * @return bool 
-        * @throws Exception 
+        * @param array $contact
+        * @param array $networks
+        * @return bool
+        * @throws Exception
         */
        private static function isAPContact(array $contact, array $networks)
        {
@@ -887,6 +878,9 @@ class Transmitter
                }
 
                $reply = DBA::selectFirst('mail', ['uri', 'uri-id', 'from-url'], ['parent-uri' => $mail['parent-uri'], 'reply' => false]);
+               if (!DBA::isResult($reply)) {
+                       $reply = $mail;
+               }
 
                // Making the post more compatible for Mastodon by:
                // - Making it a note and not an article (no title)
@@ -1079,7 +1073,7 @@ class Transmitter
                                if (!empty($self['uid'])) {
                                        $forum_item = Post::selectFirst(Item::DELIVER_FIELDLIST, ['uri-id' => $item['uri-id'], 'uid' => $self['uid']]);
                                        if (DBA::isResult($forum_item)) {
-                                               $item = $forum_item; 
+                                               $item = $forum_item;
                                        }
                                }
                        }
@@ -1298,10 +1292,24 @@ class Transmitter
                                }
                                $urls[] = $attachment['url'];
 
-                               $attachments[] = ['type' => 'Document',
+                               $attach = ['type' => 'Document',
                                        'mediaType' => $attachment['mimetype'],
                                        'url' => $attachment['url'],
                                        'name' => $attachment['description']];
+
+                               if (!empty($attachment['height'])) {
+                                       $attach['height'] = $attachment['height'];
+                               }
+
+                               if (!empty($attachment['width'])) {
+                                       $attach['width'] = $attachment['width'];
+                               }
+
+                               if (!empty($attachment['preview'])) {
+                                       $attach['image'] = $attachment['preview'];
+                               }
+
+                               $attachments[] = $attach;
                        }
                }
 
@@ -1316,10 +1324,24 @@ class Transmitter
                                }
                                $urls[] = $attachment['url'];
 
-                               $attachments[] = ['type' => 'Document',
+                               $attach = ['type' => 'Document',
                                        'mediaType' => $attachment['mimetype'],
                                        'url' => $attachment['url'],
                                        'name' => $attachment['description']];
+
+                               if (!empty($attachment['height'])) {
+                                       $attach['height'] = $attachment['height'];
+                               }
+
+                               if (!empty($attachment['width'])) {
+                                       $attach['width'] = $attachment['width'];
+                               }
+
+                               if (!empty($attachment['preview'])) {
+                                       $attach['image'] = $attachment['preview'];
+                               }
+
+                               $attachments[] = $attach;
                        }
                        // Currently deactivated, since it creates side effects on Mastodon and Pleroma.
                        // It will be activated, once this cleared.
@@ -1340,27 +1362,6 @@ class Transmitter
                return $attachments;
        }
 
-       /**
-        * Callback function to replace a Friendica style mention in a mention that is used on AP
-        *
-        * @param array $match Matching values for the callback
-        * @return string Replaced mention
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
-        */
-       private static function mentionCallback($match)
-       {
-               if (empty($match[1])) {
-                       return '';
-               }
-
-               $data = Contact::getByURL($match[1], false, ['url', 'alias', 'nick']);
-               if (empty($data['nick'])) {
-                       return $match[0];
-               }
-
-               return '[url=' . $data['url'] . ']@' . $data['nick'] . '[/url]';
-       }
-
        /**
         * Callback function to replace a Friendica style mention in a mention for a summary
         *
@@ -1461,11 +1462,11 @@ class Transmitter
        {
                $event = [];
                $event['name'] = $item['event-summary'];
-               $event['content'] = BBCode::convert($item['event-desc'], false, BBCode::ACTIVITYPUB);
-               $event['startTime'] = DateTimeFormat::utc($item['event-start'] . '+00:00', DateTimeFormat::ATOM);
+               $event['content'] = BBCode::convertForUriId($item['uri-id'], $item['event-desc'], BBCode::ACTIVITYPUB);
+               $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'])) {
@@ -1473,7 +1474,8 @@ class Transmitter
                        $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;
        }
@@ -1550,7 +1552,7 @@ class Transmitter
                 * This part is currently deactivated. The automated summary seems to be more
                 * confusing than helping. But possibly we will find a better way.
                 * So the code is left here for now as a reminder
-                * 
+                *
                 * } elseif (($type == 'Article') && empty($data['summary'])) {
                 *              $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
                 *              $summary = preg_replace_callback($regexp, ['self', 'mentionAddrCallback'], $body);
@@ -1565,10 +1567,9 @@ class Transmitter
                if ($type == 'Event') {
                        $data = array_merge($data, self::createEvent($item));
                } else {
-                       $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
-                       $body = preg_replace_callback($regexp, ['self', 'mentionCallback'], $body);
+                       $body = BBCode::setMentionsToNicknames($body);
 
-                       $data['content'] = BBCode::convert($body, false, BBCode::ACTIVITYPUB);
+                       $data['content'] = BBCode::convertForUriId($item['uri-id'], $body, BBCode::ACTIVITYPUB);
                }
 
                // The regular "content" field does contain a minimized HTML. This is done since systems like
@@ -1576,11 +1577,10 @@ class Transmitter
                // The contentMap does contain the unmodified HTML.
                $language = self::getLanguage($item);
                if (!empty($language)) {
-                       $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
-                       $richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
+                       $richbody = BBCode::setMentionsToNicknames($item['body'] ?? '');
                        $richbody = BBCode::removeAttachment($richbody);
 
-                       $data['contentMap'][$language] = BBCode::convert($richbody, false, BBCode::EXTERNAL);
+                       $data['contentMap'][$language] = BBCode::convertForUriId($item['uri-id'], $richbody, BBCode::EXTERNAL);
                }
 
                $data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];
@@ -1782,7 +1782,7 @@ class Transmitter
        {
                $owner = User::getOwnerDataById($uid);
 
-               $suggestion = DI::fsuggest()->getById($suggestion_id);
+               $suggestion = DI::fsuggest()->selectOneById($suggestion_id);
 
                $data = ['@context' => ActivityPub::CONTEXT,
                        'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
@@ -1796,7 +1796,7 @@ class Transmitter
 
                $signed = LDSignature::sign($data, $owner);
 
-               Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG);
+               Logger::info('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub');
                return HTTPSignature::transmit($signed, $inbox, $uid);
        }
 
@@ -1825,7 +1825,7 @@ class Transmitter
 
                $signed = LDSignature::sign($data, $owner);
 
-               Logger::log('Deliver profile relocation for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG);
+               Logger::info('Deliver profile relocation for user ' . $uid . ' to ' . $inbox . ' via ActivityPub');
                return HTTPSignature::transmit($signed, $inbox, $uid);
        }
 
@@ -1864,7 +1864,7 @@ class Transmitter
 
                $signed = LDSignature::sign($data, $owner);
 
-               Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG);
+               Logger::info('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub');
                return HTTPSignature::transmit($signed, $inbox, $uid);
        }
 
@@ -1875,10 +1875,11 @@ class Transmitter
         * @param string  $inbox Target inbox
         *
         * @return boolean was the transmission successful?
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+        * @throws HTTPException\InternalServerErrorException
+        * @throws HTTPException\NotFoundException
         * @throws \ImagickException
         */
-       public static function sendProfileUpdate($uid, $inbox)
+       public static function sendProfileUpdate(int $uid, string $inbox): bool
        {
                $owner = User::getOwnerDataById($uid);
                $profile = APContact::getByURL($owner['url']);
@@ -1895,7 +1896,7 @@ class Transmitter
 
                $signed = LDSignature::sign($data, $owner);
 
-               Logger::log('Deliver profile update for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG);
+               Logger::info('Deliver profile update for user ' . $uid . ' to ' . $inbox . ' via ActivityPub');
                return HTTPSignature::transmit($signed, $inbox, $uid);
        }
 
@@ -1932,7 +1933,7 @@ class Transmitter
                        'instrument' => self::getService(),
                        'to' => [$profile['url']]];
 
-               Logger::log('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, Logger::DEBUG);
+               Logger::info('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid);
 
                $signed = LDSignature::sign($data, $owner);
                return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
@@ -1971,7 +1972,7 @@ class Transmitter
                $condition = ['verb' => Activity::FOLLOW, 'uid' => 0, 'parent-uri' => $object,
                        'author-id' => Contact::getPublicIdByUserId($uid)];
                if (Post::exists($condition)) {
-                       Logger::log('Follow for ' . $object . ' for user ' . $uid . ' does already exist.', Logger::DEBUG);
+                       Logger::info('Follow for ' . $object . ' for user ' . $uid . ' does already exist.');
                        return false;
                }
 
@@ -1985,7 +1986,7 @@ class Transmitter
                        'instrument' => self::getService(),
                        'to' => [$profile['url']]];
 
-               Logger::log('Sending follow ' . $object . ' to ' . $target . ' for user ' . $uid, Logger::DEBUG);
+               Logger::info('Sending follow ' . $object . ' to ' . $target . ' for user ' . $uid);
 
                $signed = LDSignature::sign($data, $owner);
                return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
@@ -2034,15 +2035,16 @@ class Transmitter
         * @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);
@@ -2062,7 +2064,7 @@ class Transmitter
                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);
        }
 
        /**
@@ -2101,7 +2103,7 @@ class Transmitter
                        'instrument' => self::getService(),
                        'to' => [$profile['url']]];
 
-               Logger::log('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG);
+               Logger::info('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id);
 
                $signed = LDSignature::sign($data, $owner);
                return HTTPSignature::transmit($signed, $profile['inbox'], $uid);