]> git.mxchange.org Git - friendica.git/commitdiff
Use AP data when possible
authorMichael <heluecht@pirati.ca>
Sun, 4 Sep 2022 07:15:04 +0000 (07:15 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 4 Sep 2022 07:15:04 +0000 (07:15 +0000)
src/Model/FContact.php

index 8bc696a4668d2493c1d386ec3af68f037d8d051f..62f2f983648e824e33e12958a0eda4fa4c592b8e 100644 (file)
@@ -96,7 +96,12 @@ class FContact
                $uriid = ItemURI::insert(['uri' => $arr['url'], 'guid' => $arr['guid']]);
 
                $contact = Contact::getByUriId($uriid, ['id']);
-               if (!empty($contact['id'])) {
+               $apcontact = APContact::getByURL($arr['url'], false);
+               if (!empty($apcontact)) {
+                       $interacted  = $apcontact['following_count'];
+                       $interacting = $apcontact['followers_count'];
+                       $posts       = $apcontact['statuses_count'];
+               } elseif (!empty($contact['id'])) {
                        $last_interaction = DateTimeFormat::utc('now - 180 days');
 
                        $interacted  = DBA::count('contact-relation', ["`cid` = ? AND NOT `follows` AND `last-interaction` > ?", $contact['id'], $last_interaction]);