X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FDelivery.php;h=36d576cffe7b09fd1861c3b68adcab056ee3ccb0;hb=ab83d0dd27e46e733ecb49f25789bfb318852ac7;hp=8961b3f13d71d935f8947b05204117fe28a1993e;hpb=8ac8bcf0f526e42a1f6357831ca3278e9607ae45;p=friendica.git diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index 8961b3f13d..36d576cffe 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -21,6 +21,8 @@ namespace Friendica\Worker; +use Friendica\Contact\FriendSuggest\Collection\FriendSuggests; +use Friendica\Contact\FriendSuggest\Exception\FriendSuggestNotFoundException; use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Database\DBA; @@ -64,8 +66,10 @@ class Delivery } $uid = $target_item['uid']; } elseif ($cmd == self::SUGGESTION) { - $target_item = DBA::selectFirst('fsuggest', [], ['id' => $post_uriid]); - if (!DBA::isResult($target_item)) { + try { + $target_item = DI::fsuggest()->selectOneById($post_uriid)->toArray(); + } catch (FriendSuggestNotFoundException $e) { + DI::logger()->info('Cannot find FriendSuggestion', ['id' => $post_uriid]); return; } $uid = $target_item['uid']; @@ -209,7 +213,7 @@ class Delivery // Also transmit via Diaspora if this is a direct answer to a Diaspora comment. // This is done since the uri wouldn't match (Diaspora doesn't transmit it) // Also transmit relayed posts from Diaspora contacts via Diaspora. - if (($contact['network'] != Protocol::DIASPORA) && in_array(Protocol::DIASPORA, [$parent['network'] ?? '', $thr_parent['network'] ?? '', $target_item['network']])) { + if (($contact['network'] != Protocol::DIASPORA) && in_array(Protocol::DIASPORA, [$parent['network'] ?? '', $thr_parent['network'] ?? '', $target_item['network']] ?? '')) { Logger::info('Enforcing the Diaspora protocol', ['id' => $contact['id'], 'network' => $contact['network'], 'parent' => $parent['network'], 'thread-parent' => $thr_parent['network'], 'post' => $target_item['network']]); $contact['network'] = Protocol::DIASPORA; } @@ -269,7 +273,7 @@ class Delivery private static function deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup, $server_protocol) { // Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora - if (Diaspora::isReshare($target_item['body']) && !empty(FContact::getByURL($contact['addr'], false))) { + if (Diaspora::isReshare($target_item['body'] ?? '') && !empty(FContact::getByURL($contact['addr'], false))) { Logger::info('Reshare will be transmitted via Diaspora', ['url' => $contact['url'], 'guid' => ($target_item['guid'] ?? '') ?: $target_item['id']]); self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup); return; @@ -284,7 +288,7 @@ class Delivery } elseif ($cmd == self::SUGGESTION) { $item = $target_item; $atom = DFRN::fsuggest($item, $owner); - DBA::delete('fsuggest', ['id' => $item['id']]); + DI::fsuggest()->delete(new FriendSuggests([DI::fsuggest()->selectOneById($item['id'])])); } elseif ($cmd == self::RELOCATION) { $atom = DFRN::relocate($owner, $owner['uid']); } elseif ($followup) {