Show followers for pages, followed for users in ContactBlock widget

This commit is contained in:
Hypolite Petovan 2019-01-06 17:08:58 -05:00
parent 3d839bb176
commit c280fc6484

View File

@ -14,6 +14,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\User;
/** /**
* ContactBlock widget * ContactBlock widget
@ -59,6 +60,13 @@ class ContactBlock
if (!$total) { if (!$total) {
$micropro = []; $micropro = [];
} else { } 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'], [ $contact_ids_stmt = DBA::select('contact', ['id'], [
'uid' => $profile['uid'], 'uid' => $profile['uid'],
'self' => false, 'self' => false,
@ -66,7 +74,7 @@ class ContactBlock
'pending' => false, 'pending' => false,
'hidden' => false, 'hidden' => false,
'archive' => false, 'archive' => false,
'rel' => [Contact::FOLLOWER, Contact::FRIEND], 'rel' => $rel,
'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA], 'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA],
], ['limit' => $shown]); ], ['limit' => $shown]);