]> git.mxchange.org Git - friendica.git/commitdiff
Check if the Diaspora endpoint is archived
authorMichael Vogel <icarus@dabo.de>
Wed, 28 Aug 2019 14:02:19 +0000 (16:02 +0200)
committerMichael Vogel <icarus@dabo.de>
Wed, 28 Aug 2019 14:02:19 +0000 (16:02 +0200)
src/Model/Contact.php

index 4d9260d3e9a81c0096bb2a0cf1e89cdd3ef311d3..0bde409fa053707ebe6a8bb028a07ada0bfcc08c 100644 (file)
@@ -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;
        }