Display followers for followers of private forums
This commit is contained in:
parent
ce762b4154
commit
f87b80266c
|
@ -25,6 +25,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
|
||||
/**
|
||||
* ActivityPub Followers
|
||||
|
@ -45,7 +46,7 @@ class Followers extends BaseModule
|
|||
|
||||
$page = $_REQUEST['page'] ?? null;
|
||||
|
||||
$followers = ActivityPub\Transmitter::getContacts($owner, [Contact::FOLLOWER, Contact::FRIEND], 'followers', $page);
|
||||
$followers = ActivityPub\Transmitter::getContacts($owner, [Contact::FOLLOWER, Contact::FRIEND], 'followers', $page, (string)HTTPSignature::getSigner('', $_SERVER));
|
||||
|
||||
header('Content-Type: application/activity+json');
|
||||
echo json_encode($followers);
|
||||
|
|
|
@ -36,7 +36,6 @@ use Friendica\Model\GServer;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
@ -49,6 +48,7 @@ use Friendica\Util\JsonLD;
|
|||
use Friendica\Util\LDSignature;
|
||||
use Friendica\Util\Map;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
/**
|
||||
|
@ -150,11 +150,12 @@ class Transmitter
|
|||
* @param int|array $rel The relevant value(s) contact.rel should match
|
||||
* @param string $module The name of the relevant AP endpoint module (followers|following)
|
||||
* @param integer $page Page number
|
||||
* @param string $requester URL of the requester
|
||||
*
|
||||
* @return array of owners
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getContacts($owner, $rel, $module, $page = null)
|
||||
public static function getContacts($owner, $rel, $module, $page = null, string $requester = null)
|
||||
{
|
||||
$parameters = [
|
||||
'rel' => $rel,
|
||||
|
@ -179,8 +180,14 @@ class Transmitter
|
|||
$data['totalItems'] = $total;
|
||||
|
||||
// When we hide our friends we will only show the pure number but don't allow more.
|
||||
$profile = Profile::getByUID($owner['uid']);
|
||||
if (!empty($profile['hide-friends'])) {
|
||||
$show_contacts = empty($owner['hide-friends']);
|
||||
|
||||
// Allow fetching the contact list when the requester is part of the list.
|
||||
if (($owner['page-flags'] == User::PAGE_FLAGS_PRVGROUP) && !empty($requester)) {
|
||||
$show_contacts = DBA::exists('contact', ['nurl' => Strings::normaliseLink($requester), 'rel' => $rel]);
|
||||
}
|
||||
|
||||
if (!$show_contacts) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue