Merge pull request #8852 from MrPetovan/bug/notices

Address various notices
This commit is contained in:
Michael Vogel 2020-07-08 22:51:13 +02:00 committed by GitHub
commit 747eac2538
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 13 deletions

View file

@ -171,6 +171,7 @@ class Nav
}
if (local_user()) {
if (!empty($a->user)) {
// user menu
$nav['usermenu'][] = ['profile/' . $a->user['nickname'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
$nav['usermenu'][] = ['profile/' . $a->user['nickname'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
@ -185,6 +186,9 @@ class Nav
'icon' => (DBA::isResult($contact) ? DI::baseUrl()->remove($contact['micro']) : 'images/person-48.jpg'),
'name' => $a->user['username'],
];
} else {
DI::logger()->warning('Empty $a->user for local user'. ['local_user' => local_user(), '$a' => $a]);
}
}
// "Home" should also take you home from an authenticated remote profile connection

View file

@ -34,6 +34,7 @@ use Friendica\Model\Profile as ProfileModel;
use Friendica\Model\User;
use Friendica\Module\BaseProfile;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Security;
use Friendica\Util\Strings;
@ -49,6 +50,10 @@ class Status extends BaseProfile
ProfileModel::load($a, $parameters['nickname']);
if (empty($a->profile)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
if (!$a->profile['net-publish']) {
DI::page()['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
}

View file

@ -85,6 +85,11 @@ class Xrd extends BaseModule
$owner = User::getOwnerDataById($user['uid']);
if (empty($owner)) {
DI::logger()->warning('No owner data for user id', ['uri' => $uri, 'name' => $name, 'user' => $user]);
throw new \Friendica\Network\HTTPException\NotFoundException();
}
$alias = str_replace('/profile/', '/~', $owner['url']);
$avatar = Photo::selectFirst(['type'], ['uid' => $owner['uid'], 'profile' => true]);