1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-09 05:18:29 +01:00
phorge-phorge/src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php
Chad Little 26d3d41693 Update tasks/commits, remove diffs from Profile
Summary: Mostly a minor nit-pick, but I hate sending users off the profile and disorient them onto application search. These pages are pretty easy to maintain, I don't expect to need to do more here. I dropped Differential outright. Kept Tasks and Commits. Now you can browse everything about a user on their profile without leaving. Maybe add a link to ApplicationSearch? Not sure it's important.

Test Plan: Review tasks and commits on mine and other user profiles.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17470
2017-03-06 10:13:51 -08:00

71 lines
2.1 KiB
PHP

<?php
final class PhabricatorPeopleProfileMenuEngine
extends PhabricatorProfileMenuEngine {
const ITEM_PROFILE = 'people.profile';
const ITEM_MANAGE = 'people.manage';
const ITEM_PICTURE = 'people.picture';
const ITEM_BADGES = 'people.badges';
const ITEM_TASKS = 'people.tasks';
const ITEM_COMMITS = 'people.commits';
protected function isMenuEngineConfigurable() {
return false;
}
public function getItemURI($path) {
$user = $this->getProfileObject();
$username = $user->getUsername();
$username = phutil_escape_uri($username);
return "/p/{$username}/item/{$path}";
}
protected function getBuiltinProfileItems($object) {
$viewer = $this->getViewer();
$items = array();
$items[] = $this->newItem()
->setBuiltinKey(self::ITEM_PICTURE)
->setMenuItemKey(PhabricatorPeoplePictureProfileMenuItem::MENUITEMKEY);
$items[] = $this->newItem()
->setBuiltinKey(self::ITEM_PROFILE)
->setMenuItemKey(PhabricatorPeopleDetailsProfileMenuItem::MENUITEMKEY);
$have_badges = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorBadgesApplication',
$viewer);
if ($have_badges) {
$items[] = $this->newItem()
->setBuiltinKey(self::ITEM_BADGES)
->setMenuItemKey(PhabricatorPeopleBadgesProfileMenuItem::MENUITEMKEY);
}
$have_maniphest = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorManiphestApplication',
$viewer);
if ($have_maniphest) {
$items[] = $this->newItem()
->setBuiltinKey(self::ITEM_TASKS)
->setMenuItemKey(PhabricatorPeopleTasksProfileMenuItem::MENUITEMKEY);
}
$have_diffusion = PhabricatorApplication::isClassInstalledForViewer(
'PhabricatorDiffusionApplication',
$viewer);
if ($have_diffusion) {
$items[] = $this->newItem()
->setBuiltinKey(self::ITEM_COMMITS)
->setMenuItemKey(PhabricatorPeopleCommitsProfileMenuItem::MENUITEMKEY);
}
$items[] = $this->newItem()
->setBuiltinKey(self::ITEM_MANAGE)
->setMenuItemKey(PhabricatorPeopleManageProfileMenuItem::MENUITEMKEY);
return $items;
}
}