From 636b84b41c78a5dc40911ecdac27db021d7f2df6 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 24 Jun 2022 22:37:53 -0400 Subject: [PATCH 1/2] Update return value type-hint of GServer::getProtocol - Address https://github.com/friendica/friendica/issues/11630#issuecomment-1164880874 --- src/Model/GServer.php | 4 ++-- src/Worker/Delivery.php | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Model/GServer.php b/src/Model/GServer.php index 6557315ad..41a776da1 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -2047,10 +2047,10 @@ class GServer * Fetch the protocol of the given server * * @param int $gsid Server id - * @return int + * @return ?int One of Post\DeliveryData protocol constants or null if unknown or gserver is missing * @throws Exception */ - public static function getProtocol(int $gsid): int + public static function getProtocol(int $gsid): ?int { if (empty($gsid)) { return null; diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index a3c7dfdb1..7f64a9d6a 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -257,19 +257,19 @@ class Delivery /** * Deliver content via DFRN * - * @param string $cmd Command - * @param array $contact Contact record of the receiver - * @param array $owner Owner record of the sender - * @param array $items Item record of the content and the parent - * @param array $target_item Item record of the content - * @param boolean $public_message Is the content public? - * @param boolean $top_level Is it a thread starter? - * @param boolean $followup Is it an answer to a remote post? - * @param int $server_protocol The protocol of the server + * @param string $cmd Command + * @param array $contact Contact record of the receiver + * @param array $owner Owner record of the sender + * @param array $items Item record of the content and the parent + * @param array $target_item Item record of the content + * @param boolean $public_message Is the content public? + * @param boolean $top_level Is it a thread starter? + * @param boolean $followup Is it an answer to a remote post? + * @param int|null $server_protocol The protocol of the server * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException */ - private static function deliverDFRN(string $cmd, array $contact, array $owner, array $items, array $target_item, bool $public_message, bool $top_level, bool $followup, int $server_protocol) + private static function deliverDFRN(string $cmd, array $contact, array $owner, array $items, array $target_item, bool $public_message, bool $top_level, bool $followup, int $server_protocol = null) { // Transmit Diaspora reshares via Diaspora if the Friendica contact support Diaspora if (Diaspora::isReshare($target_item['body'] ?? '') && !empty(FContact::getByURL($contact['addr'], false))) { From c75dbfd3d7b78850dfcb1440841c5bef808b21ef Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 25 Jun 2022 05:03:02 -0400 Subject: [PATCH 2/2] Update default value for LocalRelationship->priority to avoid null values - Address https://github.com/friendica/friendica/issues/11630#issuecomment-1166192993 --- src/Contact/LocalRelationship/Factory/LocalRelationship.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Contact/LocalRelationship/Factory/LocalRelationship.php b/src/Contact/LocalRelationship/Factory/LocalRelationship.php index 74ddd8e7a..5e53f5b46 100644 --- a/src/Contact/LocalRelationship/Factory/LocalRelationship.php +++ b/src/Contact/LocalRelationship/Factory/LocalRelationship.php @@ -52,7 +52,7 @@ class LocalRelationship extends BaseFactory implements ICanCreateFromTableRow $row['hub-verify'] ?? '', $row['protocol'] ?? Protocol::PHANTOM, $row['rating'] ?? null, - $row['priority'] ?? null + $row['priority'] ?? 0 ); } }