@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+303 -34
+8
src/__phutil_library_map__.php
··· 3340 3340 'PhabricatorPeopleApplication' => 'applications/people/application/PhabricatorPeopleApplication.php', 3341 3341 'PhabricatorPeopleApproveController' => 'applications/people/controller/PhabricatorPeopleApproveController.php', 3342 3342 'PhabricatorPeopleBadgesProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleBadgesProfileMenuItem.php', 3343 + 'PhabricatorPeopleCommitsProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php', 3343 3344 'PhabricatorPeopleController' => 'applications/people/controller/PhabricatorPeopleController.php', 3344 3345 'PhabricatorPeopleCreateController' => 'applications/people/controller/PhabricatorPeopleCreateController.php', 3345 3346 'PhabricatorPeopleCreateGuidanceContext' => 'applications/people/guidance/PhabricatorPeopleCreateGuidanceContext.php', ··· 3365 3366 'PhabricatorPeopleOwnerDatasource' => 'applications/people/typeahead/PhabricatorPeopleOwnerDatasource.php', 3366 3367 'PhabricatorPeoplePictureProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeoplePictureProfileMenuItem.php', 3367 3368 'PhabricatorPeopleProfileBadgesController' => 'applications/people/controller/PhabricatorPeopleProfileBadgesController.php', 3369 + 'PhabricatorPeopleProfileCommitsController' => 'applications/people/controller/PhabricatorPeopleProfileCommitsController.php', 3368 3370 'PhabricatorPeopleProfileController' => 'applications/people/controller/PhabricatorPeopleProfileController.php', 3369 3371 'PhabricatorPeopleProfileEditController' => 'applications/people/controller/PhabricatorPeopleProfileEditController.php', 3370 3372 'PhabricatorPeopleProfileImageWorkflow' => 'applications/people/management/PhabricatorPeopleProfileImageWorkflow.php', 3371 3373 'PhabricatorPeopleProfileManageController' => 'applications/people/controller/PhabricatorPeopleProfileManageController.php', 3372 3374 'PhabricatorPeopleProfileMenuEngine' => 'applications/people/engine/PhabricatorPeopleProfileMenuEngine.php', 3373 3375 'PhabricatorPeopleProfilePictureController' => 'applications/people/controller/PhabricatorPeopleProfilePictureController.php', 3376 + 'PhabricatorPeopleProfileTasksController' => 'applications/people/controller/PhabricatorPeopleProfileTasksController.php', 3374 3377 'PhabricatorPeopleProfileViewController' => 'applications/people/controller/PhabricatorPeopleProfileViewController.php', 3375 3378 'PhabricatorPeopleQuery' => 'applications/people/query/PhabricatorPeopleQuery.php', 3376 3379 'PhabricatorPeopleRenameController' => 'applications/people/controller/PhabricatorPeopleRenameController.php', 3377 3380 'PhabricatorPeopleSearchEngine' => 'applications/people/query/PhabricatorPeopleSearchEngine.php', 3381 + 'PhabricatorPeopleTasksProfileMenuItem' => 'applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php', 3378 3382 'PhabricatorPeopleTestDataGenerator' => 'applications/people/lipsum/PhabricatorPeopleTestDataGenerator.php', 3379 3383 'PhabricatorPeopleTransactionQuery' => 'applications/people/query/PhabricatorPeopleTransactionQuery.php', 3380 3384 'PhabricatorPeopleUserFunctionDatasource' => 'applications/people/typeahead/PhabricatorPeopleUserFunctionDatasource.php', ··· 8528 8532 'PhabricatorPeopleApplication' => 'PhabricatorApplication', 8529 8533 'PhabricatorPeopleApproveController' => 'PhabricatorPeopleController', 8530 8534 'PhabricatorPeopleBadgesProfileMenuItem' => 'PhabricatorProfileMenuItem', 8535 + 'PhabricatorPeopleCommitsProfileMenuItem' => 'PhabricatorProfileMenuItem', 8531 8536 'PhabricatorPeopleController' => 'PhabricatorController', 8532 8537 'PhabricatorPeopleCreateController' => 'PhabricatorPeopleController', 8533 8538 'PhabricatorPeopleCreateGuidanceContext' => 'PhabricatorGuidanceContext', ··· 8553 8558 'PhabricatorPeopleOwnerDatasource' => 'PhabricatorTypeaheadCompositeDatasource', 8554 8559 'PhabricatorPeoplePictureProfileMenuItem' => 'PhabricatorProfileMenuItem', 8555 8560 'PhabricatorPeopleProfileBadgesController' => 'PhabricatorPeopleProfileController', 8561 + 'PhabricatorPeopleProfileCommitsController' => 'PhabricatorPeopleProfileController', 8556 8562 'PhabricatorPeopleProfileController' => 'PhabricatorPeopleController', 8557 8563 'PhabricatorPeopleProfileEditController' => 'PhabricatorPeopleProfileController', 8558 8564 'PhabricatorPeopleProfileImageWorkflow' => 'PhabricatorPeopleManagementWorkflow', 8559 8565 'PhabricatorPeopleProfileManageController' => 'PhabricatorPeopleProfileController', 8560 8566 'PhabricatorPeopleProfileMenuEngine' => 'PhabricatorProfileMenuEngine', 8561 8567 'PhabricatorPeopleProfilePictureController' => 'PhabricatorPeopleProfileController', 8568 + 'PhabricatorPeopleProfileTasksController' => 'PhabricatorPeopleProfileController', 8562 8569 'PhabricatorPeopleProfileViewController' => 'PhabricatorPeopleProfileController', 8563 8570 'PhabricatorPeopleQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 8564 8571 'PhabricatorPeopleRenameController' => 'PhabricatorPeopleController', 8565 8572 'PhabricatorPeopleSearchEngine' => 'PhabricatorApplicationSearchEngine', 8573 + 'PhabricatorPeopleTasksProfileMenuItem' => 'PhabricatorProfileMenuItem', 8566 8574 'PhabricatorPeopleTestDataGenerator' => 'PhabricatorTestDataGenerator', 8567 8575 'PhabricatorPeopleTransactionQuery' => 'PhabricatorApplicationTransactionQuery', 8568 8576 'PhabricatorPeopleUserFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
+4
src/applications/people/application/PhabricatorPeopleApplication.php
··· 66 66 'PhabricatorPeopleProfileEditController', 67 67 'badges/(?P<id>[1-9]\d*)/' => 68 68 'PhabricatorPeopleProfileBadgesController', 69 + 'tasks/(?P<id>[1-9]\d*)/' => 70 + 'PhabricatorPeopleProfileTasksController', 71 + 'commits/(?P<id>[1-9]\d*)/' => 72 + 'PhabricatorPeopleProfileCommitsController', 69 73 'picture/(?P<id>[1-9]\d*)/' => 70 74 'PhabricatorPeopleProfilePictureController', 71 75 'manage/(?P<id>[1-9]\d*)/' =>
+81
src/applications/people/controller/PhabricatorPeopleProfileCommitsController.php
··· 1 + <?php 2 + 3 + final class PhabricatorPeopleProfileCommitsController 4 + extends PhabricatorPeopleProfileController { 5 + 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $this->getViewer(); 8 + $id = $request->getURIData('id'); 9 + 10 + $user = id(new PhabricatorPeopleQuery()) 11 + ->setViewer($viewer) 12 + ->withIDs(array($id)) 13 + ->needProfile(true) 14 + ->needProfileImage(true) 15 + ->needAvailability(true) 16 + ->requireCapabilities( 17 + array( 18 + PhabricatorPolicyCapability::CAN_VIEW, 19 + )) 20 + ->executeOne(); 21 + if (!$user) { 22 + return new Aphront404Response(); 23 + } 24 + 25 + $class = 'PhabricatorDiffusionApplication'; 26 + if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { 27 + return new Aphront404Response(); 28 + } 29 + 30 + $this->setUser($user); 31 + $title = array(pht('Recent Commits'), $user->getUsername()); 32 + $header = $this->buildProfileHeader(); 33 + $commits = $this->buildCommitsView($user); 34 + 35 + $crumbs = $this->buildApplicationCrumbs(); 36 + $crumbs->addTextCrumb(pht('Recent Commits')); 37 + $crumbs->setBorder(true); 38 + 39 + $nav = $this->getProfileMenu(); 40 + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::ITEM_COMMITS); 41 + 42 + $view = id(new PHUITwoColumnView()) 43 + ->setHeader($header) 44 + ->addClass('project-view-home') 45 + ->addClass('project-view-people-home') 46 + ->setFooter(array( 47 + $commits, 48 + )); 49 + 50 + return $this->newPage() 51 + ->setTitle($title) 52 + ->setCrumbs($crumbs) 53 + ->setNavigation($nav) 54 + ->appendChild($view); 55 + } 56 + 57 + private function buildCommitsView(PhabricatorUser $user) { 58 + $viewer = $this->getViewer(); 59 + 60 + $commits = id(new DiffusionCommitQuery()) 61 + ->setViewer($viewer) 62 + ->requireCapabilities( 63 + array( 64 + PhabricatorPolicyCapability::CAN_VIEW, 65 + )) 66 + ->setLimit(100) 67 + ->execute(); 68 + 69 + $list = id(new PhabricatorAuditListView()) 70 + ->setViewer($viewer) 71 + ->setCommits($commits) 72 + ->setNoDataString(pht('No recent commits.')); 73 + 74 + $view = id(new PHUIObjectBoxView()) 75 + ->setHeaderText(pht('Recent Commits')) 76 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 77 + ->appendChild($list); 78 + 79 + return $view; 80 + } 81 + }
+86
src/applications/people/controller/PhabricatorPeopleProfileTasksController.php
··· 1 + <?php 2 + 3 + final class PhabricatorPeopleProfileTasksController 4 + extends PhabricatorPeopleProfileController { 5 + 6 + public function handleRequest(AphrontRequest $request) { 7 + $viewer = $this->getViewer(); 8 + $id = $request->getURIData('id'); 9 + 10 + $user = id(new PhabricatorPeopleQuery()) 11 + ->setViewer($viewer) 12 + ->withIDs(array($id)) 13 + ->needProfile(true) 14 + ->needProfileImage(true) 15 + ->needAvailability(true) 16 + ->requireCapabilities( 17 + array( 18 + PhabricatorPolicyCapability::CAN_VIEW, 19 + )) 20 + ->executeOne(); 21 + if (!$user) { 22 + return new Aphront404Response(); 23 + } 24 + 25 + $class = 'PhabricatorManiphestApplication'; 26 + if (!PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) { 27 + return new Aphront404Response(); 28 + } 29 + 30 + $this->setUser($user); 31 + $title = array(pht('Assigned Tasks'), $user->getUsername()); 32 + $header = $this->buildProfileHeader(); 33 + $tasks = $this->buildTasksView($user); 34 + 35 + $crumbs = $this->buildApplicationCrumbs(); 36 + $crumbs->addTextCrumb(pht('Assigned Tasks')); 37 + $crumbs->setBorder(true); 38 + 39 + $nav = $this->getProfileMenu(); 40 + $nav->selectFilter(PhabricatorPeopleProfileMenuEngine::ITEM_TASKS); 41 + 42 + $view = id(new PHUITwoColumnView()) 43 + ->setHeader($header) 44 + ->addClass('project-view-home') 45 + ->addClass('project-view-people-home') 46 + ->setFooter(array( 47 + $tasks, 48 + )); 49 + 50 + return $this->newPage() 51 + ->setTitle($title) 52 + ->setCrumbs($crumbs) 53 + ->setNavigation($nav) 54 + ->appendChild($view); 55 + } 56 + 57 + private function buildTasksView(PhabricatorUser $user) { 58 + $viewer = $this->getViewer(); 59 + 60 + $tasks = id(new ManiphestTaskQuery()) 61 + ->setViewer($viewer) 62 + ->withOwners(array($user->getPHID())) 63 + ->needProjectPHIDs(true) 64 + ->requireCapabilities( 65 + array( 66 + PhabricatorPolicyCapability::CAN_VIEW, 67 + )) 68 + ->setLimit(100) 69 + ->execute(); 70 + 71 + $handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks); 72 + 73 + $list = id(new ManiphestTaskListView()) 74 + ->setUser($viewer) 75 + ->setHandles($handles) 76 + ->setTasks($tasks) 77 + ->setNoDataString(pht('No assigned tasks.')); 78 + 79 + $view = id(new PHUIObjectBoxView()) 80 + ->setHeaderText(pht('Assigned Tasks')) 81 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 82 + ->appendChild($list); 83 + 84 + return $view; 85 + } 86 + }
+6 -34
src/applications/people/engine/PhabricatorPeopleProfileMenuEngine.php
··· 7 7 const ITEM_MANAGE = 'people.manage'; 8 8 const ITEM_PICTURE = 'people.picture'; 9 9 const ITEM_BADGES = 'people.badges'; 10 + const ITEM_TASKS = 'people.tasks'; 11 + const ITEM_COMMITS = 'people.commits'; 10 12 11 13 protected function isMenuEngineConfigurable() { 12 14 return false; ··· 45 47 'PhabricatorManiphestApplication', 46 48 $viewer); 47 49 if ($have_maniphest) { 48 - $uri = urisprintf( 49 - '/maniphest/?statuses=open()&assigned=%s#R', 50 - $object->getPHID()); 51 - 52 50 $items[] = $this->newItem() 53 - ->setBuiltinKey('tasks') 54 - ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) 55 - ->setMenuItemProperty('icon', 'maniphest') 56 - ->setMenuItemProperty('name', pht('Open Tasks')) 57 - ->setMenuItemProperty('uri', $uri); 58 - } 59 - 60 - $have_differential = PhabricatorApplication::isClassInstalledForViewer( 61 - 'PhabricatorDifferentialApplication', 62 - $viewer); 63 - if ($have_differential) { 64 - $uri = urisprintf( 65 - '/differential/?authors=%s#R', 66 - $object->getPHID()); 67 - 68 - $items[] = $this->newItem() 69 - ->setBuiltinKey('revisions') 70 - ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) 71 - ->setMenuItemProperty('icon', 'differential') 72 - ->setMenuItemProperty('name', pht('Revisions')) 73 - ->setMenuItemProperty('uri', $uri); 51 + ->setBuiltinKey(self::ITEM_TASKS) 52 + ->setMenuItemKey(PhabricatorPeopleTasksProfileMenuItem::MENUITEMKEY); 74 53 } 75 54 76 55 $have_diffusion = PhabricatorApplication::isClassInstalledForViewer( 77 56 'PhabricatorDiffusionApplication', 78 57 $viewer); 79 58 if ($have_diffusion) { 80 - $uri = urisprintf( 81 - '/diffusion/commit/?authors=%s#R', 82 - $object->getPHID()); 83 - 84 59 $items[] = $this->newItem() 85 - ->setBuiltinKey('commits') 86 - ->setMenuItemKey(PhabricatorLinkProfileMenuItem::MENUITEMKEY) 87 - ->setMenuItemProperty('icon', 'diffusion') 88 - ->setMenuItemProperty('name', pht('Commits')) 89 - ->setMenuItemProperty('uri', $uri); 60 + ->setBuiltinKey(self::ITEM_COMMITS) 61 + ->setMenuItemKey(PhabricatorPeopleCommitsProfileMenuItem::MENUITEMKEY); 90 62 } 91 63 92 64 $items[] = $this->newItem()
+59
src/applications/people/menuitem/PhabricatorPeopleCommitsProfileMenuItem.php
··· 1 + <?php 2 + 3 + final class PhabricatorPeopleCommitsProfileMenuItem 4 + extends PhabricatorProfileMenuItem { 5 + 6 + const MENUITEMKEY = 'people.commits'; 7 + 8 + public function getMenuItemTypeName() { 9 + return pht('Commits'); 10 + } 11 + 12 + private function getDefaultName() { 13 + return pht('Commits'); 14 + } 15 + 16 + public function canHideMenuItem( 17 + PhabricatorProfileMenuItemConfiguration $config) { 18 + return true; 19 + } 20 + 21 + public function getDisplayName( 22 + PhabricatorProfileMenuItemConfiguration $config) { 23 + $name = $config->getMenuItemProperty('name'); 24 + 25 + if (strlen($name)) { 26 + return $name; 27 + } 28 + 29 + return $this->getDefaultName(); 30 + } 31 + 32 + public function buildEditEngineFields( 33 + PhabricatorProfileMenuItemConfiguration $config) { 34 + return array( 35 + id(new PhabricatorTextEditField()) 36 + ->setKey('name') 37 + ->setLabel(pht('Name')) 38 + ->setPlaceholder($this->getDefaultName()) 39 + ->setValue($config->getMenuItemProperty('name')), 40 + ); 41 + } 42 + 43 + protected function newNavigationMenuItems( 44 + PhabricatorProfileMenuItemConfiguration $config) { 45 + 46 + $user = $config->getProfileObject(); 47 + $id = $user->getID(); 48 + 49 + $item = $this->newItem() 50 + ->setHref("/people/commits/{$id}/") 51 + ->setName($this->getDisplayName($config)) 52 + ->setIcon('fa-code'); 53 + 54 + return array( 55 + $item, 56 + ); 57 + } 58 + 59 + }
+59
src/applications/people/menuitem/PhabricatorPeopleTasksProfileMenuItem.php
··· 1 + <?php 2 + 3 + final class PhabricatorPeopleTasksProfileMenuItem 4 + extends PhabricatorProfileMenuItem { 5 + 6 + const MENUITEMKEY = 'people.tasks'; 7 + 8 + public function getMenuItemTypeName() { 9 + return pht('Tasks'); 10 + } 11 + 12 + private function getDefaultName() { 13 + return pht('Tasks'); 14 + } 15 + 16 + public function canHideMenuItem( 17 + PhabricatorProfileMenuItemConfiguration $config) { 18 + return true; 19 + } 20 + 21 + public function getDisplayName( 22 + PhabricatorProfileMenuItemConfiguration $config) { 23 + $name = $config->getMenuItemProperty('name'); 24 + 25 + if (strlen($name)) { 26 + return $name; 27 + } 28 + 29 + return $this->getDefaultName(); 30 + } 31 + 32 + public function buildEditEngineFields( 33 + PhabricatorProfileMenuItemConfiguration $config) { 34 + return array( 35 + id(new PhabricatorTextEditField()) 36 + ->setKey('name') 37 + ->setLabel(pht('Name')) 38 + ->setPlaceholder($this->getDefaultName()) 39 + ->setValue($config->getMenuItemProperty('name')), 40 + ); 41 + } 42 + 43 + protected function newNavigationMenuItems( 44 + PhabricatorProfileMenuItemConfiguration $config) { 45 + 46 + $user = $config->getProfileObject(); 47 + $id = $user->getID(); 48 + 49 + $item = $this->newItem() 50 + ->setHref("/people/tasks/{$id}/") 51 + ->setName($this->getDisplayName($config)) 52 + ->setIcon('fa-anchor'); 53 + 54 + return array( 55 + $item, 56 + ); 57 + } 58 + 59 + }