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

Move inline edit from task lists to EditEngine

Summary: Ref T9908. Fixes T8903. This moves the inline edit from task lists (but not from workboards) over to editengine.

Test Plan:
- Edited a task from a draggable list.
- Edited a task from an undraggable list.
- Edited a task, changed projects, saw refresh show correct projects.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8903, T9908

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

+80 -17
+1 -1
src/applications/maniphest/controller/ManiphestController.php
··· 37 37 return $crumbs; 38 38 } 39 39 40 - protected function renderSingleTask(ManiphestTask $task) { 40 + public function renderSingleTask(ManiphestTask $task) { 41 41 $request = $this->getRequest(); 42 42 $user = $request->getUser(); 43 43
+1
src/applications/maniphest/controller/ManiphestTaskEditProController.php
··· 5 5 public function handleRequest(AphrontRequest $request) { 6 6 return id(new ManiphestEditEngine()) 7 7 ->setController($this) 8 + ->addContextParameter('ungrippable') 8 9 ->buildResponse(); 9 10 } 10 11
+38 -10
src/applications/maniphest/editor/ManiphestEditEngine.php
··· 83 83 ->setTransactionType(ManiphestTransaction::TYPE_TITLE) 84 84 ->setIsRequired(true) 85 85 ->setValue($object->getTitle()), 86 + id(new PhabricatorUsersEditField()) 87 + ->setKey('owner') 88 + ->setAliases(array('ownerPHID', 'assign', 'assigned')) 89 + ->setLabel(pht('Assigned To')) 90 + ->setDescription(pht('User who is responsible for the task.')) 91 + ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 92 + ->setIsCopyable(true) 93 + ->setSingleValue($object->getOwnerPHID()) 94 + ->setCommentActionLabel(pht('Assign / Claim')) 95 + ->setCommentActionDefaultValue($owner_value), 86 96 id(new PhabricatorSelectEditField()) 87 97 ->setKey('status') 88 98 ->setLabel(pht('Status')) ··· 93 103 ->setOptions($status_map) 94 104 ->setCommentActionLabel(pht('Change Status')) 95 105 ->setCommentActionDefaultValue($default_status), 96 - id(new PhabricatorUsersEditField()) 97 - ->setKey('owner') 98 - ->setAliases(array('ownerPHID', 'assign', 'assigned')) 99 - ->setLabel(pht('Assigned To')) 100 - ->setDescription(pht('User who is responsible for the task.')) 101 - ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 102 - ->setIsCopyable(true) 103 - ->setSingleValue($object->getOwnerPHID()) 104 - ->setCommentActionLabel(pht('Assign / Claim')) 105 - ->setCommentActionDefaultValue($owner_value), 106 106 id(new PhabricatorSelectEditField()) 107 107 ->setKey('priority') 108 108 ->setLabel(pht('Priority')) ··· 187 187 } 188 188 189 189 return $priority_map; 190 + } 191 + 192 + protected function newEditResponse( 193 + AphrontRequest $request, 194 + $object, 195 + array $xactions) { 196 + $viewer = $this->getViewer(); 197 + $controller = $this->getController(); 198 + 199 + if ($request->isAjax()) { 200 + 201 + // Reload the task to make sure we pick up the final task state. 202 + $task = id(new ManiphestTaskQuery()) 203 + ->setViewer($viewer) 204 + ->withIDs(array($object->getID())) 205 + ->needSubscriberPHIDs(true) 206 + ->needProjectPHIDs(true) 207 + ->executeOne(); 208 + 209 + $payload = array( 210 + 'tasks' => $controller->renderSingleTask($task), 211 + 'data' => array(), 212 + ); 213 + 214 + return id(new AphrontAjaxResponse())->setContent($payload); 215 + } 216 + 217 + return parent::newEditResponse(); 190 218 } 191 219 192 220 }
+1 -1
src/applications/maniphest/view/ManiphestTaskListView.php
··· 111 111 )); 112 112 113 113 if ($this->showBatchControls) { 114 - $href = new PhutilURI('/maniphest/task/edit/'.$task->getID().'/'); 114 + $href = new PhutilURI('/maniphest/editpro/'.$task->getID().'/'); 115 115 if (!$this->showSubpriorityControls) { 116 116 $href->setQueryParam('ungrippable', 'true'); 117 117 }
+39 -5
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 22 22 private $controller; 23 23 private $isCreate; 24 24 private $editEngineConfiguration; 25 + private $contextParameters = array(); 25 26 26 27 final public function setViewer(PhabricatorUser $viewer) { 27 28 $this->viewer = $viewer; ··· 49 50 final public function getApplication() { 50 51 $app_class = $this->getEngineApplicationClass(); 51 52 return PhabricatorApplication::getByClass($app_class); 53 + } 54 + 55 + final public function addContextParameter($key) { 56 + $this->contextParameters[] = $key; 57 + return $this; 52 58 } 53 59 54 60 ··· 879 885 $header_text = $this->getObjectEditTitleText($object); 880 886 } 881 887 888 + $form = $this->buildEditForm($object, $fields); 889 + 890 + if ($request->isAjax()) { 891 + if ($this->getIsCreate()) { 892 + $cancel_uri = $this->getObjectCreateCancelURI($object); 893 + $submit_button = $this->getObjectCreateButtonText($object); 894 + } else { 895 + $cancel_uri = $this->getObjectEditCancelURI($object); 896 + $submit_button = $this->getObjectEditButtonText($object); 897 + } 898 + 899 + return $this->getController() 900 + ->newDialog() 901 + ->setWidth(AphrontDialogView::WIDTH_FULL) 902 + ->setTitle($header_text) 903 + ->setValidationException($validation_exception) 904 + ->appendForm($form) 905 + ->addCancelButton($cancel_uri) 906 + ->addSubmitButton($submit_button); 907 + } 908 + 882 909 $header = id(new PHUIHeaderView()) 883 910 ->setHeader($header_text) 884 911 ->addActionLink($action_button); 885 912 886 913 $crumbs = $this->buildCrumbs($object, $final = true); 887 - $form = $this->buildEditForm($object, $fields); 888 914 889 915 $box = id(new PHUIObjectBoxView()) 890 916 ->setUser($viewer) ··· 908 934 909 935 private function buildEditForm($object, array $fields) { 910 936 $viewer = $this->getViewer(); 937 + $controller = $this->getController(); 938 + $request = $controller->getRequest(); 911 939 912 940 $form = id(new AphrontFormView()) 913 941 ->setUser($viewer); 914 942 943 + foreach ($this->contextParameters as $param) { 944 + $form->addHiddenInput($param, $request->getStr($param)); 945 + } 946 + 915 947 foreach ($fields as $field) { 916 948 $field->appendToForm($form); 917 949 } ··· 924 956 $submit_button = $this->getObjectEditButtonText($object); 925 957 } 926 958 927 - $form->appendControl( 928 - id(new AphrontFormSubmitControl()) 929 - ->addCancelButton($cancel_uri) 930 - ->setValue($submit_button)); 959 + if (!$request->isAjax()) { 960 + $form->appendControl( 961 + id(new AphrontFormSubmitControl()) 962 + ->addCancelButton($cancel_uri) 963 + ->setValue($submit_button)); 964 + } 931 965 932 966 return $form; 933 967 }