page = $page; $this->conversation = $conversation; $this->localRelationship = $localRelationship; $this->userSession = $userSession; } protected function content(array $request = []): string { if (!$this->userSession->getLocalUserId()) { return Login::form($_SERVER['REQUEST_URI']); } // Backward compatibility: Ensure to use the public contact when the user contact is provided // Remove by version 2022.03 $pcid = Model\Contact::getPublicContactId(intval($this->parameters['id']), $this->userSession->getLocalUserId()); if (!$pcid) { throw new NotFoundException($this->t('Contact not found.')); } $contact = Model\Contact::getAccountById($pcid); if (empty($contact)) { throw new NotFoundException($this->t('Contact not found.')); } // Don't display contacts that are about to be deleted if ($contact['deleted'] || $contact['network'] == Protocol::PHANTOM) { throw new NotFoundException($this->t('Contact not found.')); } $localRelationship = $this->localRelationship->getForUserContact($this->userSession->getLocalUserId(), $contact['id']); if ($localRelationship->rel === Model\Contact::SELF) { $this->baseUrl->redirect('profile/' . $contact['nick']); } // Load necessary libraries for the status editor $this->page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js')); $this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); $this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); $this->page['aside'] .= Widget\VCard::getHTML($contact, true); Nav::setSelected('contact'); if (!$contact['ap-posting-restricted']) { $options = [ 'lockstate' => ACL::getLockstateForUserId($this->userSession->getLocalUserId()) ? 'lock' : 'unlock', 'acl' => ACL::getFullSelectorHTML($this->page, $this->userSession->getLocalUserId(), true, []), 'bang' => '', 'content' => ($contact['contact-type'] == ModelContact::TYPE_COMMUNITY ? '!' : '@') . ($contact['addr'] ?: $contact['url']), ]; $o = $this->conversation->statusEditor($options); } $o .= Contact::getTabsHTML($contact, Contact::TAB_CONVERSATIONS); $o .= Model\Contact::getThreadsFromId($contact['id'], $this->userSession->getLocalUserId(), 0, 0, $request['last_created'] ?? ''); return $o; } }