1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Display same items in mobile menu on User Profile page as on desktop

Summary:
Display same items in mobile menu on User Profile page as on desktop. (The code did not make too much sense anyway here?)

Also remove special but dysfunctional "Calendar" item in mobile view: The resulting URI does not work even if the calendar application is installed. If it ever worked, it should be moved to the default desktop sidebar anyway and not be a mobile-only menu item.

Closes T15224

Test Plan: Open http://phorge.localhost/people/ and http://phorge.localhost/p/username and http://phorge.localhost/people/manage/1/, change screen width to less and more than 920px, check at menu items in left bar (>920px) and right upper corner (<920px).

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15224

Differential Revision: https://we.phorge.it/D25687
This commit is contained in:
Andre Klapper 2024-06-18 20:00:14 +02:00
parent 000bccf8e4
commit 5d479556c3
2 changed files with 19 additions and 22 deletions

View file

@ -6,39 +6,33 @@ abstract class PhabricatorPeopleController extends PhabricatorController {
return true;
}
/**
* return AphrontSideNavFilterView
*/
public function buildSideNavView($for_app = false) {
// we are on /people/*
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$name = null;
if ($for_app) {
$name = $this->getRequest()->getURIData('username');
if ($name) {
$nav->setBaseURI(new PhutilURI('/p/'));
$nav->addFilter("{$name}/", $name);
if (id(new PhabricatorCalendarApplication())->isInstalled()) {
$nav->addFilter("{$name}/calendar/", pht('Calendar'));
}
}
}
$viewer = $this->getRequest()->getUser();
id(new PhabricatorPeopleSearchEngine())
->setViewer($viewer)
->addNavigationItems($nav->getMenu());
if (!$name) {
$viewer = $this->getRequest()->getUser();
id(new PhabricatorPeopleSearchEngine())
->setViewer($viewer)
->addNavigationItems($nav->getMenu());
if ($viewer->getIsAdmin()) {
$nav->addLabel(pht('User Administration'));
$nav->addFilter('logs', pht('Activity Logs'));
$nav->addFilter('invite', pht('Email Invitations'));
}
if ($viewer->getIsAdmin()) {
$nav->addLabel(pht('User Administration'));
$nav->addFilter('logs', pht('Activity Logs'));
$nav->addFilter('invite', pht('Email Invitations'));
}
return $nav;
}
public function buildApplicationMenu() {
if ($this->getRequest()->getURIData('username')) {
// we are on /p/name/ so return the default user profile sidebar
return parent::buildApplicationMenu();
}
return $this->buildSideNavView(true)->getMenu();
}

View file

@ -87,6 +87,9 @@ abstract class PhabricatorProfileMenuEngine extends Phobject {
abstract public function getItemURI($path);
abstract protected function isMenuEngineConfigurable();
/**
* @return array of PhabricatorProfileMenuItemConfiguration objects
*/
abstract protected function getBuiltinProfileItems($object);
protected function getBuiltinCustomProfileItems(