]> git.mxchange.org Git - friendica.git/commitdiff
Show followers for pages, followed for users in ContactBlock widget
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 6 Jan 2019 22:08:58 +0000 (17:08 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Jan 2019 15:56:28 +0000 (10:56 -0500)
src/Content/Widget/ContactBlock.php

index 12cd4cd87d2055a08917d624b4b14e405222a211..33f72af40e82c0128286942475b413e58f38d6a5 100644 (file)
@@ -14,6 +14,7 @@ use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
+use Friendica\Model\User;
 
 /**
  * ContactBlock widget
@@ -59,6 +60,13 @@ class ContactBlock
                if (!$total) {
                        $micropro = [];
                } else {
+                       // Only show followed for personal accounts, followers for pages
+                       if (defaults($profile, 'account-type', User::ACCOUNT_TYPE_PERSON) == User::ACCOUNT_TYPE_PERSON) {
+                               $rel = [Contact::FOLLOWER, Contact::FRIEND];
+                       } else {
+                               $rel = [Contact::SHARING, Contact::FRIEND];
+                       }
+
                        $contact_ids_stmt = DBA::select('contact', ['id'], [
                                'uid' => $profile['uid'],
                                'self' => false,
@@ -66,7 +74,7 @@ class ContactBlock
                                'pending' => false,
                                'hidden' => false,
                                'archive' => false,
-                               'rel' => [Contact::FOLLOWER, Contact::FRIEND],
+                               'rel' => $rel,
                                'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA],
                        ], ['limit' => $shown]);