@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.

Make some defaults for Quick Create / Favorites

Summary: Add in some basic defaults, Tasks, Projects, Repositories... anything else? Also switches "manage" context if you are an admin or user. Hides link if you are not logged in.

Test Plan: Review Global/Personal in Favorites app, click on each link.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D17174

+60 -12
+3
src/applications/favorites/constants/PhabricatorFavoritesConstants.php
··· 3 3 final class PhabricatorFavoritesConstants 4 4 extends PhabricatorFavoritesController { 5 5 6 + const ITEM_TASK = 'favorites.task'; 7 + const ITEM_PROJECT = 'favorites.project'; 8 + const ITEM_REPOSITORY = 'favorites.repository'; 6 9 const ITEM_MANAGE = 'favorites.manage'; 7 10 8 11 }
+39 -5
src/applications/favorites/engine/PhabricatorFavoritesProfileMenuEngine.php
··· 20 20 21 21 protected function getBuiltinProfileItems($object) { 22 22 $items = array(); 23 + $custom_phid = $this->getCustomPHID(); 23 24 24 - $custom = $this->getCustomPHID(); 25 + // Built-in Global Defaults 26 + if (!$custom_phid) { 27 + $create_task = array( 28 + 'name' => null, 29 + 'formKey' => 30 + id(new ManiphestEditEngine())->getProfileMenuItemDefault(), 31 + ); 25 32 26 - if ($custom) { 33 + $create_project = array( 34 + 'name' => null, 35 + 'formKey' => 36 + id(new PhabricatorProjectEditEngine())->getProfileMenuItemDefault(), 37 + ); 38 + 39 + $create_repository = array( 40 + 'name' => null, 41 + 'formKey' => 42 + id(new DiffusionRepositoryEditEngine())->getProfileMenuItemDefault(), 43 + ); 44 + 27 45 $items[] = $this->newItem() 28 - ->setBuiltinKey(PhabricatorFavoritesConstants::ITEM_MANAGE) 29 - ->setMenuItemKey( 30 - PhabricatorFavoritesManageProfileMenuItem::MENUITEMKEY); 46 + ->setBuiltinKey(PhabricatorFavoritesConstants::ITEM_TASK) 47 + ->setMenuItemKey(PhabricatorEditEngineProfileMenuItem::MENUITEMKEY) 48 + ->setMenuItemProperties($create_task); 49 + 50 + $items[] = $this->newItem() 51 + ->setBuiltinKey(PhabricatorFavoritesConstants::ITEM_PROJECT) 52 + ->setMenuItemKey(PhabricatorEditEngineProfileMenuItem::MENUITEMKEY) 53 + ->setMenuItemProperties($create_project); 54 + 55 + $items[] = $this->newItem() 56 + ->setBuiltinKey(PhabricatorFavoritesConstants::ITEM_REPOSITORY) 57 + ->setMenuItemKey(PhabricatorEditEngineProfileMenuItem::MENUITEMKEY) 58 + ->setMenuItemProperties($create_repository); 31 59 } 60 + 61 + // Single Manage Item, switches URI based on admin/user 62 + $items[] = $this->newItem() 63 + ->setBuiltinKey(PhabricatorFavoritesConstants::ITEM_MANAGE) 64 + ->setMenuItemKey( 65 + PhabricatorFavoritesManageProfileMenuItem::MENUITEMKEY); 32 66 33 67 return $items; 34 68 }
+14 -7
src/applications/favorites/menuitem/PhabricatorFavoritesManageProfileMenuItem.php
··· 47 47 48 48 protected function newNavigationMenuItems( 49 49 PhabricatorProfileMenuItemConfiguration $config) { 50 + $viewer = $this->getViewer(); 50 51 51 - $name = $this->getDisplayName($config); 52 - $icon = 'fa-pencil'; 53 - $href = '/favorites/personal/item/configure/'; 52 + if ($viewer->isLoggedIn()) { 53 + $admin = $viewer->getIsAdmin(); 54 + $name = $this->getDisplayName($config); 55 + $icon = 'fa-pencil'; 56 + $href = '/favorites/personal/item/configure/'; 57 + if ($admin) { 58 + $href = '/favorites/'; 59 + } 54 60 55 - $item = $this->newItem() 56 - ->setHref($href) 57 - ->setName($name) 58 - ->setIcon($icon); 61 + $item = $this->newItem() 62 + ->setHref($href) 63 + ->setName($name) 64 + ->setIcon($icon); 65 + } 59 66 60 67 return array( 61 68 $item,
+4
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 107 107 return $this->hideHeader; 108 108 } 109 109 110 + public function getProfileMenuItemDefault() { 111 + return $this->getEngineKey().'/'.self::EDITENGINECONFIG_DEFAULT; 112 + } 113 + 110 114 111 115 /* -( Managing Fields )---------------------------------------------------- */ 112 116