mirror of
https://github.com/friendica/friendica
synced 2025-05-09 23:44:09 +02:00
The access to the profile and the list of followers/followings can now be restricted
This commit is contained in:
parent
d84866cf8c
commit
26aa38341f
3 changed files with 52 additions and 8 deletions
|
@ -195,7 +195,7 @@ class Transmitter
|
|||
}
|
||||
|
||||
// When we hide our friends we will only show the pure number but don't allow more.
|
||||
$show_contacts = empty($owner['hide-friends']);
|
||||
$show_contacts = ActivityPub::isAcceptedRequester($owner['uid']) && 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)) {
|
||||
|
@ -337,12 +337,13 @@ class Transmitter
|
|||
/**
|
||||
* Return the ActivityPub profile of the given user
|
||||
*
|
||||
* @param int $uid User ID
|
||||
* @param int $uid User ID
|
||||
* @param bool $limited If limited, only the basic information is returned
|
||||
* @return array with profile data
|
||||
* @throws HTTPException\NotFoundException
|
||||
* @throws HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function getProfile(int $uid): array
|
||||
public static function getProfile(int $uid, bool $limited = false): array
|
||||
{
|
||||
$owner = User::getOwnerDataById($uid);
|
||||
if (!isset($owner['id'])) {
|
||||
|
@ -372,16 +373,16 @@ class Transmitter
|
|||
$data['preferredUsername'] = $owner['nick'];
|
||||
$data['name'] = $owner['name'];
|
||||
|
||||
if (!empty($owner['country-name'] . $owner['region'] . $owner['locality'])) {
|
||||
if (!$limited && !empty($owner['country-name'] . $owner['region'] . $owner['locality'])) {
|
||||
$data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'],
|
||||
'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']];
|
||||
}
|
||||
|
||||
if (!empty($owner['about'])) {
|
||||
if (!$limited && !empty($owner['about'])) {
|
||||
$data['summary'] = BBCode::convertForUriId($owner['uri-id'] ?? 0, $owner['about'], BBCode::EXTERNAL);
|
||||
}
|
||||
|
||||
if (!empty($owner['xmpp']) || !empty($owner['matrix'])) {
|
||||
if (!$limited && (!empty($owner['xmpp']) || !empty($owner['matrix']))) {
|
||||
$data['vcard:hasInstantMessage'] = [];
|
||||
|
||||
if (!empty($owner['xmpp'])) {
|
||||
|
@ -399,7 +400,7 @@ class Transmitter
|
|||
'owner' => $owner['url'],
|
||||
'publicKeyPem' => $owner['pubkey']];
|
||||
$data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox'];
|
||||
if ($uid != 0) {
|
||||
if (!$limited && $uid != 0) {
|
||||
$data['icon'] = ['type' => 'Image', 'url' => User::getAvatarUrl($owner)];
|
||||
|
||||
$resourceid = Photo::ridFromURI($owner['photo']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue