Remove direct calls to App->user

This commit is contained in:
Michael 2021-08-08 10:14:56 +00:00
commit fc283ab928
51 changed files with 238 additions and 166 deletions

View file

@ -201,8 +201,8 @@ function frio_remote_nav(App $a, array &$nav_info)
// since $userinfo isn't available for the hook we write it to the nav array
// this isn't optimal because the contact query will be done now twice
$fields = ['id', 'url', 'avatar', 'micro', 'name', 'nick', 'baseurl'];
if (local_user() && !empty($a->user['uid'])) {
$remoteUser = Contact::selectFirst($fields, ['uid' => $a->user['uid'], 'self' => true]);
if (local_user() && !empty($a->getUserId())) {
$remoteUser = Contact::selectFirst($fields, ['uid' => $a->getUserId(), 'self' => true]);
} elseif (!local_user() && remote_user()) {
$remoteUser = Contact::getById(remote_user(), $fields);
$nav_info['nav']['remote'] = DI::l10n()->t('Guest');

View file

@ -27,7 +27,7 @@ function vier_init(App $a)
$args = DI::args();
if ($args->get(0) === 'profile' && $args->get(1) === ($a->user['nickname'] ?? '') || $args->get(0) === 'network' && local_user()
if ($args->get(0) === 'profile' && $args->get(1) === ($a->getNickname() ?? '') || $args->get(0) === 'network' && local_user()
) {
vier_community_info();