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

Limit number of EditEngine tokenizer tokens in "Owner" field UI to 1

Summary:
Ref T9132. Only allow a task to have a single owner in the UI.

In Conduit, make this field appear and behave as "phid" instead of "list<phid>".

Test Plan: Edited a task with new fancy form, got limited to one owner. Assigned/unassigned. Used Conduit to assign/unassign.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9132

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

+38 -12
+3 -11
src/applications/maniphest/editor/ManiphestEditEngine.php
··· 58 58 unset($status_map[$dup_status]); 59 59 } 60 60 61 - $owner_phid = $object->getOwnerPHID(); 62 - if ($owner_phid) { 63 - $owner_value = array($owner_phid); 64 - } else { 65 - $owner_value = array(); 66 - } 67 - 68 61 $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); 69 62 70 63 // TODO: Restore these or toss them: 71 - // - Require a single owner. 72 64 // - Default owner to viewer. 73 65 // - Don't show "change status" for closed tasks. 74 66 // - Don't show "change owner" for closed tasks. ··· 92 84 ->setValue($object->getStatus()) 93 85 ->setOptions($status_map), 94 86 id(new PhabricatorUsersEditField()) 95 - ->setKey('assigned') 96 - ->setAliases(array('assign', 'assignee')) 87 + ->setKey('owner') 88 + ->setAliases(array('ownerPHID', 'assign', 'assigned')) 97 89 ->setLabel(pht('Assigned To')) 98 90 ->setDescription(pht('User who is responsible for the task.')) 99 91 ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 100 - ->setValue($owner_value), 92 + ->setSingleValue($object->getOwnerPHID()), 101 93 id(new PhabricatorSelectEditField()) 102 94 ->setKey('priority') 103 95 ->setLabel(pht('Priority'))
+31 -1
src/applications/transactions/editfield/PhabricatorPHIDListEditField.php
··· 5 5 6 6 private $useEdgeTransactions; 7 7 private $transactionDescriptions = array(); 8 + private $isSingleValue; 8 9 9 10 public function setUseEdgeTransactions($use_edge_transactions) { 10 11 $this->useEdgeTransactions = $use_edge_transactions; ··· 22 23 '=' => $set, 23 24 ); 24 25 return $this; 26 + } 27 + 28 + public function setSingleValue($value) { 29 + if ($value === null) { 30 + $value = array(); 31 + } else { 32 + $value = array($value); 33 + } 34 + 35 + $this->isSingleValue = true; 36 + return $this->setValue($value); 37 + } 38 + 39 + public function getIsSingleValue() { 40 + return $this->isSingleValue; 25 41 } 26 42 27 43 protected function newHTTPParameterType() { ··· 31 47 public function getValueForTransaction() { 32 48 $new = parent::getValueForTransaction(); 33 49 50 + if ($this->getIsSingleValue()) { 51 + if ($new) { 52 + return head($new); 53 + } else { 54 + return null; 55 + } 56 + } 57 + 34 58 if (!$this->getUseEdgeTransactions()) { 35 59 return $new; 36 60 } ··· 68 92 return new PhabricatorEdgeEditType(); 69 93 } 70 94 71 - return parent::newEditType(); 95 + $type = parent::newEditType(); 96 + 97 + if ($this->getIsSingleValue()) { 98 + $type->setValueType('phid'); 99 + } 100 + 101 + return $type; 72 102 } 73 103 74 104 public function getConduitEditTypes() {
+4
src/applications/transactions/editfield/PhabricatorTokenizerEditField.php
··· 25 25 $control->setOriginalValue($initial_value); 26 26 } 27 27 28 + if ($this->getIsSingleValue()) { 29 + $control->setLimit(1); 30 + } 31 + 28 32 return $control; 29 33 } 30 34