full instead of limited

This commit is contained in:
Michael 2023-07-22 01:40:21 +00:00
parent 26aa38341f
commit 579b7065bd
2 changed files with 8 additions and 8 deletions

View File

@ -84,7 +84,7 @@ class Profile extends BaseProfile
$user = $this->database->selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname'] ?? '', 'account_removed' => false]); $user = $this->database->selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname'] ?? '', 'account_removed' => false]);
if ($user) { if ($user) {
try { try {
$data = ActivityPub\Transmitter::getProfile($user['uid'], !ActivityPub::isAcceptedRequester($user['uid'])); $data = ActivityPub\Transmitter::getProfile($user['uid'], ActivityPub::isAcceptedRequester($user['uid']));
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Origin: *');
header('Cache-Control: max-age=23200, stale-while-revalidate=23200'); header('Cache-Control: max-age=23200, stale-while-revalidate=23200');
System::jsonExit($data, 'application/activity+json'); System::jsonExit($data, 'application/activity+json');

View File

@ -338,12 +338,12 @@ class Transmitter
* Return the ActivityPub profile of the given user * 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 * @param bool $full If not full, only the basic information is returned
* @return array with profile data * @return array with profile data
* @throws HTTPException\NotFoundException * @throws HTTPException\NotFoundException
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function getProfile(int $uid, bool $limited = false): array public static function getProfile(int $uid, bool $full = true): array
{ {
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
if (!isset($owner['id'])) { if (!isset($owner['id'])) {
@ -373,16 +373,16 @@ class Transmitter
$data['preferredUsername'] = $owner['nick']; $data['preferredUsername'] = $owner['nick'];
$data['name'] = $owner['name']; $data['name'] = $owner['name'];
if (!$limited && !empty($owner['country-name'] . $owner['region'] . $owner['locality'])) { if (!$full && !empty($owner['country-name'] . $owner['region'] . $owner['locality'])) {
$data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'], $data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $owner['country-name'],
'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']]; 'vcard:region' => $owner['region'], 'vcard:locality' => $owner['locality']];
} }
if (!$limited && !empty($owner['about'])) { if ($full && !empty($owner['about'])) {
$data['summary'] = BBCode::convertForUriId($owner['uri-id'] ?? 0, $owner['about'], BBCode::EXTERNAL); $data['summary'] = BBCode::convertForUriId($owner['uri-id'] ?? 0, $owner['about'], BBCode::EXTERNAL);
} }
if (!$limited && (!empty($owner['xmpp']) || !empty($owner['matrix']))) { if ($full && (!empty($owner['xmpp']) || !empty($owner['matrix']))) {
$data['vcard:hasInstantMessage'] = []; $data['vcard:hasInstantMessage'] = [];
if (!empty($owner['xmpp'])) { if (!empty($owner['xmpp'])) {
@ -400,7 +400,7 @@ class Transmitter
'owner' => $owner['url'], 'owner' => $owner['url'],
'publicKeyPem' => $owner['pubkey']]; 'publicKeyPem' => $owner['pubkey']];
$data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox']; $data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox'];
if (!$limited && $uid != 0) { if ($full && $uid != 0) {
$data['icon'] = ['type' => 'Image', 'url' => User::getAvatarUrl($owner)]; $data['icon'] = ['type' => 'Image', 'url' => User::getAvatarUrl($owner)];
$resourceid = Photo::ridFromURI($owner['photo']); $resourceid = Photo::ridFromURI($owner['photo']);