Account type relay / fix missing baseurl for own contacts

This commit is contained in:
Michael 2024-01-29 06:28:43 +00:00
parent 9af5abaf0b
commit 9bd8d974b3
5 changed files with 150 additions and 137 deletions

View file

@ -784,6 +784,7 @@ class Contact
'name-date' => DateTimeFormat::utcNow(),
'uri-date' => DateTimeFormat::utcNow(),
'avatar-date' => DateTimeFormat::utcNow(),
'baseurl' => DI::baseUrl(),
'closeness' => 0
];
@ -819,7 +820,7 @@ class Contact
$fields = [
'id', 'uri-id', 'name', 'nick', 'location', 'about', 'keywords', 'avatar', 'prvkey', 'pubkey', 'manually-approve',
'xmpp', 'matrix', 'contact-type', 'forum', 'prv', 'avatar-date', 'url', 'nurl', 'unsearchable',
'photo', 'thumb', 'micro', 'header', 'addr', 'request', 'notify', 'poll', 'confirm', 'poco', 'network'
'photo', 'thumb', 'micro', 'header', 'addr', 'request', 'notify', 'poll', 'confirm', 'poco', 'network', 'baseurl', 'gsid'
];
$self = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
if (!DBA::isResult($self)) {
@ -902,6 +903,8 @@ class Contact
$fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP;
$fields['unsearchable'] = !$profile['net-publish'];
$fields['manually-approve'] = in_array($user['page-flags'], [User::PAGE_FLAGS_NORMAL, User::PAGE_FLAGS_PRVGROUP]);
$fields['baseurl'] = DI::baseUrl();
$fields['gsid'] = GServer::getID($fields['baseurl'], true);
$update = false;
@ -1747,6 +1750,10 @@ class Contact
$account_type = DI::l10n()->t("Group");
break;
case self::TYPE_RELAY:
$account_type = DI::l10n()->t("Relay");
break;
default:
$account_type = "";
break;

View file

@ -127,6 +127,9 @@ class User
case 'community':
return self::ACCOUNT_TYPE_COMMUNITY;
case 'relay':
return self::ACCOUNT_TYPE_RELAY;
}
return null;
}
@ -477,7 +480,7 @@ class User
// Check for correct url and normalised nurl
$url = DI::baseUrl() . '/profile/' . $owner['nickname'];
$repair = empty($owner['network']) || ($owner['url'] != $url) || ($owner['nurl'] != Strings::normaliseLink($owner['url']));
$repair = empty($owner['baseurl']) || empty($owner['network']) || ($owner['url'] != $url) || ($owner['nurl'] != Strings::normaliseLink($owner['url']));
if (!$repair) {
// Check if "addr" is present and correct