From 3c9834922cf4f0f8d5316b8bf8551df90f24baf2 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 28 Aug 2019 16:02:19 +0200 Subject: [PATCH] Check if the Diaspora endpoint is archived --- src/Model/Contact.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 4d9260d3e9..0bde409fa0 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1564,13 +1564,13 @@ class Contact extends BaseObject * @return boolean Is the contact archived? * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function isArchived($cid) + public static function isArchived(int $cid) { if ($cid == 0) { return false; } - $archived = DBA::selectFirst('contact', ['archive', 'url'], ['id' => $cid]); + $archived = DBA::selectFirst('contact', ['archive', 'url', 'batch'], ['id' => $cid]); if (!DBA::isResult($archived)) { return false; } @@ -1592,7 +1592,10 @@ class Contact extends BaseObject return true; } - /// @todo Add tests for Diaspora endpoints as well + if (!empty($archived['batch'])) { + return DBA::exists('contact', ['archive' => true, 'batch' => $archived['batch'], 'contact-type' => self::TYPE_RELAY]); + } + return false; }