Fix noscrape publishing and pulling, added header

This commit is contained in:
Michael 2021-06-17 11:23:32 +00:00
parent 5419d1d426
commit fe07dc828b
16 changed files with 36 additions and 28 deletions

View file

@ -211,6 +211,11 @@ class APContact
$apcontact['photo'] = JsonLD::fetchElement($compacted['as:icon'], 'as:url', '@id');
}
$apcontact['header'] = JsonLD::fetchElement($compacted, 'as:image', '@id');
if (is_array($apcontact['header']) || !empty($compacted['as:image']['as:url']['@id'])) {
$apcontact['header'] = JsonLD::fetchElement($compacted['as:image'], 'as:url', '@id');
}
if (empty($apcontact['alias'])) {
$apcontact['alias'] = JsonLD::fetchElement($compacted, 'as:url', '@id');
if (is_array($apcontact['alias'])) {

View file

@ -1103,7 +1103,7 @@ class Contact
if (($uid == 0) && (empty($data['network']) || ($data['network'] == Protocol::PHANTOM))) {
// Fetch data for the public contact via the first found personal contact
/// @todo Check if this case can happen at all (possibly with mail accounts?)
$fields = ['name', 'nick', 'url', 'addr', 'alias', 'avatar', 'contact-type',
$fields = ['name', 'nick', 'url', 'addr', 'alias', 'avatar', 'header', 'contact-type',
'keywords', 'location', 'about', 'unsearchable', 'batch', 'notify', 'poll',
'request', 'confirm', 'poco', 'subscribe', 'network', 'baseurl', 'gsid'];
@ -1949,8 +1949,8 @@ class Contact
// These fields aren't updated by this routine:
// 'xmpp', 'sensitive'
$fields = ['uid', 'avatar', 'name', 'nick', 'location', 'keywords', 'about', 'subscribe', 'manually-approve',
'unsearchable', 'url', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco',
$fields = ['uid', 'avatar', 'header', 'name', 'nick', 'location', 'keywords', 'about', 'subscribe',
'manually-approve', 'unsearchable', 'url', 'addr', 'batch', 'notify', 'poll', 'request', 'confirm', 'poco',
'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey', 'last-item'];
$contact = DBA::selectFirst('contact', $fields, ['id' => $id]);
if (!DBA::isResult($contact)) {

View file

@ -283,24 +283,17 @@ class Profile
}
/**
* Get all profile data of a local user
*
* If the viewer is an authenticated remote viewer, the profile displayed is the
* one that has been configured for his/her viewing in the Contact manager.
* Passing a non-zero profile ID can also allow a preview of a selected profile
* by the owner
* Get the profile for the given nick name
*
* Includes all available profile data
*
* @param string $nickname nick
* @param int $uid uid
* @param int $profile_id ID of the profile
* @return array
* @throws \Exception
*/
public static function getByNickname($nickname, $uid = 0)
public static function getByNickname($nickname)
{
$profile = DBA::selectFirst('owner-view', [], ['nickname' => $nickname, 'uid' => $uid]);
$profile = DBA::selectFirst('owner-view', [], ['nickname' => $nickname]);
return $profile;
}