Issue 14349: Fix profile page for unrelated contacts

This commit is contained in:
Michael 2024-08-11 05:56:58 +00:00
parent 66e9807876
commit 131e330e61
8 changed files with 440 additions and 476 deletions

View file

@ -165,10 +165,12 @@ class Profile extends BaseModule
}
// Fetch the protocol from the user's contact.
$usercontact = Contact::getById($data['user'], ['network', 'protocol']);
if ($this->db->isResult($usercontact)) {
$contact['network'] = $usercontact['network'];
$contact['protocol'] = $usercontact['protocol'];
if ($data['user']) {
$usercontact = Contact::getById($data['user'], ['network', 'protocol']);
if ($this->db->isResult($usercontact)) {
$contact['network'] = $usercontact['network'];
$contact['protocol'] = $usercontact['protocol'];
}
}
if (empty($contact['network']) && Contact::isLocal($contact['url']) ) {
@ -177,7 +179,7 @@ class Profile extends BaseModule
}
// Don't display contacts that are about to be deleted
if ($this->db->isResult($contact) && (!empty($contact['deleted']) || !empty($contact['network']) && $contact['network'] == Protocol::PHANTOM)) {
if ($contact['deleted'] || $contact['network'] == Protocol::PHANTOM) {
throw new HTTPException\NotFoundException($this->t('Contact not found.'));
}