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

Use standard UI kit on project member page

Summary: Fixes T4400. Removes very, very old "PhabricatorObjectListView", which was only used here.

Test Plan: {F132249}

Reviewers: chad, btrahan

Reviewed By: btrahan

Subscribers: epriestley, chad

Maniphest Tasks: T4400

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

+110 -128
-2
resources/celerity/map.php
··· 95 95 'rsrc/css/application/ponder/post.css' => 'ebab8a70', 96 96 'rsrc/css/application/ponder/vote.css' => '8ed6ed8b', 97 97 'rsrc/css/application/profile/profile-view.css' => '9bdb9804', 98 - 'rsrc/css/application/projects/phabricator-object-list-view.css' => '1a1ea560', 99 98 'rsrc/css/application/projects/project-tag.css' => '095c9404', 100 99 'rsrc/css/application/releeph/releeph-branch.css' => 'b8821d2d', 101 100 'rsrc/css/application/releeph/releeph-colors.css' => '2d2d6aa8', ··· 705 704 'phabricator-notification' => '0c6946e7', 706 705 'phabricator-notification-css' => '6901121e', 707 706 'phabricator-notification-menu-css' => 'fc9a363c', 708 - 'phabricator-object-list-view-css' => '1a1ea560', 709 707 'phabricator-object-selector-css' => '029a133d', 710 708 'phabricator-phtize' => 'd254d646', 711 709 'phabricator-prefab' => '0326e5d0',
+2 -2
src/__phutil_library_map__.php
··· 1735 1735 'PhabricatorObjectHandleStatus' => 'applications/phid/handle/const/PhabricatorObjectHandleStatus.php', 1736 1736 'PhabricatorObjectListQuery' => 'applications/phid/query/PhabricatorObjectListQuery.php', 1737 1737 'PhabricatorObjectListQueryTestCase' => 'applications/phid/query/__tests__/PhabricatorObjectListQueryTestCase.php', 1738 - 'PhabricatorObjectListView' => 'view/control/PhabricatorObjectListView.php', 1739 1738 'PhabricatorObjectMailReceiver' => 'applications/metamta/receiver/PhabricatorObjectMailReceiver.php', 1740 1739 'PhabricatorObjectMailReceiverTestCase' => 'applications/metamta/receiver/__tests__/PhabricatorObjectMailReceiverTestCase.php', 1741 1740 'PhabricatorObjectQuery' => 'applications/phid/query/PhabricatorObjectQuery.php', ··· 1864 1863 'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php', 1865 1864 'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php', 1866 1865 'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php', 1866 + 'PhabricatorProjectMembersRemoveController' => 'applications/project/controller/PhabricatorProjectMembersRemoveController.php', 1867 1867 'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php', 1868 1868 'PhabricatorProjectNameCollisionException' => 'applications/project/exception/PhabricatorProjectNameCollisionException.php', 1869 1869 'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php', ··· 4494 4494 'PhabricatorObjectHandle' => 'PhabricatorPolicyInterface', 4495 4495 'PhabricatorObjectHandleStatus' => 'PhabricatorObjectHandleConstants', 4496 4496 'PhabricatorObjectListQueryTestCase' => 'PhabricatorTestCase', 4497 - 'PhabricatorObjectListView' => 'AphrontView', 4498 4497 'PhabricatorObjectMailReceiver' => 'PhabricatorMailReceiver', 4499 4498 'PhabricatorObjectMailReceiverTestCase' => 'PhabricatorTestCase', 4500 4499 'PhabricatorObjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', ··· 4654 4653 1 => 'PhabricatorApplicationSearchResultsControllerInterface', 4655 4654 ), 4656 4655 'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController', 4656 + 'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController', 4657 4657 'PhabricatorProjectMoveController' => 'PhabricatorProjectController', 4658 4658 'PhabricatorProjectNameCollisionException' => 'Exception', 4659 4659 'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType',
+2
src/applications/project/application/PhabricatorApplicationProject.php
··· 44 44 'PhabricatorProjectArchiveController', 45 45 'members/(?P<id>[1-9]\d*)/' 46 46 => 'PhabricatorProjectMembersEditController', 47 + 'members/(?P<id>[1-9]\d*)/remove/' 48 + => 'PhabricatorProjectMembersRemoveController', 47 49 'view/(?P<id>[1-9]\d*)/' 48 50 => 'PhabricatorProjectProfileController', 49 51 'picture/(?P<id>[1-9]\d*)/' =>
+24 -38
src/applications/project/controller/PhabricatorProjectMembersEditController.php
··· 76 76 $header_name = pht('Edit Members'); 77 77 $title = pht('Edit Members'); 78 78 79 - $list = $this->renderMemberList($handles); 80 - 81 79 $form = new AphrontFormView(); 82 80 $form 83 81 ->setUser($user) ··· 90 88 id(new AphrontFormSubmitControl()) 91 89 ->addCancelButton('/project/view/'.$project->getID().'/') 92 90 ->setValue(pht('Add Members'))); 93 - $faux_form = id(new AphrontFormView()) 94 - ->setUser($user) 95 - ->appendChild( 96 - id(new AphrontFormInsetView()) 97 - ->appendChild($list)); 98 91 99 - $box = id(new PHUIObjectBoxView()) 100 - ->setHeaderText(pht('Current Members (%d)', count($handles))) 101 - ->setForm($faux_form); 92 + $member_list = $this->renderMemberList($project, $handles); 102 93 103 94 $form_box = id(new PHUIObjectBoxView()) 104 95 ->setHeaderText($title) ··· 114 105 array( 115 106 $crumbs, 116 107 $form_box, 117 - $box, 108 + $member_list, 118 109 ), 119 110 array( 120 111 'title' => $title, ··· 122 113 )); 123 114 } 124 115 125 - private function renderMemberList(array $handles) { 116 + private function renderMemberList( 117 + PhabricatorProject $project, 118 + array $handles) { 119 + 126 120 $request = $this->getRequest(); 127 - $user = $request->getUser(); 128 - $list = id(new PhabricatorObjectListView()) 129 - ->setHandles($handles); 121 + $viewer = $request->getUser(); 122 + 123 + $list = id(new PHUIObjectItemListView()) 124 + ->setNoDataString(pht('This project does not have any members.')); 130 125 131 126 foreach ($handles as $handle) { 132 - $hidden_input = phutil_tag( 133 - 'input', 134 - array( 135 - 'type' => 'hidden', 136 - 'name' => 'remove', 137 - 'value' => $handle->getPHID(), 138 - ), 139 - ''); 127 + $remove_uri = $this->getApplicationURI( 128 + '/members/'.$project->getID().'/remove/?phid='.$handle->getPHID()); 140 129 141 - $button = javelin_tag( 142 - 'button', 143 - array( 144 - 'class' => 'grey', 145 - ), 146 - pht('Remove')); 130 + $item = id(new PHUIObjectItemView()) 131 + ->setHeader($handle->getFullName()) 132 + ->setHref($handle->getURI()) 133 + ->setImageURI($handle->getImageURI()); 134 + 135 + $item->addAction( 136 + id(new PHUIListItemView()) 137 + ->setIcon('delete') 138 + ->setName(pht('Remove')) 139 + ->setHref($remove_uri) 140 + ->setWorkflow(true)); 147 141 148 - $list->addButton( 149 - $handle, 150 - phabricator_form( 151 - $user, 152 - array( 153 - 'method' => 'POST', 154 - 'action' => $request->getRequestURI(), 155 - ), 156 - array($hidden_input, $button))); 142 + $list->addItem($item); 157 143 } 158 144 159 145 return $list;
+82
src/applications/project/controller/PhabricatorProjectMembersRemoveController.php
··· 1 + <?php 2 + 3 + final class PhabricatorProjectMembersRemoveController 4 + extends PhabricatorProjectController { 5 + 6 + private $id; 7 + 8 + public function willProcessRequest(array $data) { 9 + $this->id = $data['id']; 10 + } 11 + 12 + public function processRequest() { 13 + $request = $this->getRequest(); 14 + $viewer = $request->getUser(); 15 + 16 + $project = id(new PhabricatorProjectQuery()) 17 + ->setViewer($viewer) 18 + ->withIDs(array($this->id)) 19 + ->needMembers(true) 20 + ->requireCapabilities( 21 + array( 22 + PhabricatorPolicyCapability::CAN_VIEW, 23 + PhabricatorPolicyCapability::CAN_EDIT, 24 + )) 25 + ->executeOne(); 26 + if (!$project) { 27 + return new Aphront404Response(); 28 + } 29 + 30 + $member_phids = $project->getMemberPHIDs(); 31 + $remove_phid = $request->getStr('phid'); 32 + 33 + if (!in_array($remove_phid, $member_phids)) { 34 + return new Aphront404Response(); 35 + } 36 + 37 + $members_uri = $this->getApplicationURI('members/'.$project->getID().'/'); 38 + 39 + if ($request->isFormPost()) { 40 + $member_spec = array(); 41 + $member_spec['-'] = array($remove_phid => $remove_phid); 42 + 43 + $type_member = PhabricatorEdgeConfig::TYPE_PROJ_MEMBER; 44 + 45 + $xactions = array(); 46 + 47 + $xactions[] = id(new PhabricatorProjectTransaction()) 48 + ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) 49 + ->setMetadataValue('edge:type', $type_member) 50 + ->setNewValue($member_spec); 51 + 52 + $editor = id(new PhabricatorProjectTransactionEditor($project)) 53 + ->setActor($viewer) 54 + ->setContentSourceFromRequest($request) 55 + ->setContinueOnNoEffect(true) 56 + ->setContinueOnMissingFields(true) 57 + ->applyTransactions($project, $xactions); 58 + 59 + return id(new AphrontRedirectResponse()) 60 + ->setURI($members_uri); 61 + } 62 + 63 + $handle = id(new PhabricatorHandleQuery()) 64 + ->setViewer($viewer) 65 + ->withPHIDs(array($remove_phid)) 66 + ->executeOne(); 67 + 68 + $dialog = id(new AphrontDialogView()) 69 + ->setUser($viewer) 70 + ->setTitle(pht('Really Remove Member?')) 71 + ->appendParagraph( 72 + pht( 73 + 'Really remove %s from the project %s?', 74 + phutil_tag('strong', array(), $handle->getName()), 75 + phutil_tag('strong', array(), $project->getName()))) 76 + ->addCancelButton($members_uri) 77 + ->addSubmitButton(pht('Remove Project Member')); 78 + 79 + return id(new AphrontDialogResponse())->setDialog($dialog); 80 + } 81 + 82 + }
-59
src/view/control/PhabricatorObjectListView.php
··· 1 - <?php 2 - 3 - final class PhabricatorObjectListView extends AphrontView { 4 - 5 - private $handles = array(); 6 - private $buttons = array(); 7 - 8 - public function setHandles(array $handles) { 9 - assert_instances_of($handles, 'PhabricatorObjectHandle'); 10 - 11 - $this->handles = $handles; 12 - return $this; 13 - } 14 - 15 - public function addButton(PhabricatorObjectHandle $handle, $button) { 16 - $this->buttons[$handle->getPHID()][] = $button; 17 - return $this; 18 - } 19 - 20 - public function render() { 21 - $handles = $this->handles; 22 - 23 - require_celerity_resource('phabricator-object-list-view-css'); 24 - 25 - $out = array(); 26 - foreach ($handles as $handle) { 27 - $buttons = idx($this->buttons, $handle->getPHID(), array()); 28 - if ($buttons) { 29 - $buttons = phutil_tag( 30 - 'div', 31 - array( 32 - 'class' => 'phabricator-object-list-view-buttons', 33 - ), 34 - $buttons); 35 - } else { 36 - $buttons = null; 37 - } 38 - 39 - $out[] = javelin_tag( 40 - 'div', 41 - array( 42 - 'class' => 'phabricator-object-list-view-item', 43 - 'style' => 'background-image: url('.$handle->getImageURI().');', 44 - ), 45 - array( 46 - $handle->renderLink(), 47 - $buttons, 48 - )); 49 - } 50 - 51 - return phutil_tag( 52 - 'div', 53 - array( 54 - 'class' => 'phabricator-object-list-view', 55 - ), 56 - $out); 57 - } 58 - 59 - }
-27
webroot/rsrc/css/application/projects/phabricator-object-list-view.css
··· 1 - /** 2 - * @provides phabricator-object-list-view-css 3 - */ 4 - 5 - .phabricator-object-list-view { 6 - max-height: 400px; 7 - overflow-y: auto; 8 - } 9 - 10 - .phabricator-object-list-view-item { 11 - line-height: 60px; 12 - background-repeat: no-repeat; 13 - background-position: 5px 5px; 14 - padding-left: 70px; 15 - position: relative; 16 - } 17 - 18 - .phabricator-object-list-view-item + .phabricator-object-list-view-item { 19 - border-top: 1px solid rgba(0, 0, 0, 0.05); 20 - } 21 - 22 - .phabricator-object-list-view-buttons { 23 - position: absolute; 24 - text-align: right; 25 - top: 0; 26 - right: 0; 27 - }