mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-24 07:42:40 +01:00
11578bfc90
Summary: Ref T12423. Adds back revisions as a user profile page. I don't want to think about custom profiles for a while. Test Plan: Make some diffs, visit my profile, see diffs. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12423 Differential Revision: https://secure.phabricator.com/D17987
82 lines
2.5 KiB
PHP
82 lines
2.5 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';
|
|
const ITEM_REVISIONS = 'people.revisions';
|
|
|
|
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_differential = PhabricatorApplication::isClassInstalledForViewer(
|
|
'PhabricatorDifferentialApplication',
|
|
$viewer);
|
|
if ($have_differential) {
|
|
$items[] = $this->newItem()
|
|
->setBuiltinKey(self::ITEM_REVISIONS)
|
|
->setMenuItemKey(
|
|
PhabricatorPeopleRevisionsProfileMenuItem::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;
|
|
}
|
|
|
|
}
|