Page MenuHomePhabricator

D14666.diff
No OneTemporary

D14666.diff

diff --git a/src/applications/maniphest/editor/ManiphestEditEngine.php b/src/applications/maniphest/editor/ManiphestEditEngine.php
--- a/src/applications/maniphest/editor/ManiphestEditEngine.php
+++ b/src/applications/maniphest/editor/ManiphestEditEngine.php
@@ -58,17 +58,9 @@
unset($status_map[$dup_status]);
}
- $owner_phid = $object->getOwnerPHID();
- if ($owner_phid) {
- $owner_value = array($owner_phid);
- } else {
- $owner_value = array();
- }
-
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
// TODO: Restore these or toss them:
- // - Require a single owner.
// - Default owner to viewer.
// - Don't show "change status" for closed tasks.
// - Don't show "change owner" for closed tasks.
@@ -92,12 +84,12 @@
->setValue($object->getStatus())
->setOptions($status_map),
id(new PhabricatorUsersEditField())
- ->setKey('assigned')
- ->setAliases(array('assign', 'assignee'))
+ ->setKey('owner')
+ ->setAliases(array('ownerPHID', 'assign', 'assigned'))
->setLabel(pht('Assigned To'))
->setDescription(pht('User who is responsible for the task.'))
->setTransactionType(ManiphestTransaction::TYPE_OWNER)
- ->setValue($owner_value),
+ ->setSingleValue($object->getOwnerPHID()),
id(new PhabricatorSelectEditField())
->setKey('priority')
->setLabel(pht('Priority'))
diff --git a/src/applications/transactions/editfield/PhabricatorPHIDListEditField.php b/src/applications/transactions/editfield/PhabricatorPHIDListEditField.php
--- a/src/applications/transactions/editfield/PhabricatorPHIDListEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorPHIDListEditField.php
@@ -5,6 +5,7 @@
private $useEdgeTransactions;
private $transactionDescriptions = array();
+ private $isSingleValue;
public function setUseEdgeTransactions($use_edge_transactions) {
$this->useEdgeTransactions = $use_edge_transactions;
@@ -24,6 +25,21 @@
return $this;
}
+ public function setSingleValue($value) {
+ if ($value === null) {
+ $value = array();
+ } else {
+ $value = array($value);
+ }
+
+ $this->isSingleValue = true;
+ return $this->setValue($value);
+ }
+
+ public function getIsSingleValue() {
+ return $this->isSingleValue;
+ }
+
protected function newHTTPParameterType() {
return new AphrontPHIDListHTTPParameterType();
}
@@ -31,6 +47,14 @@
public function getValueForTransaction() {
$new = parent::getValueForTransaction();
+ if ($this->getIsSingleValue()) {
+ if ($new) {
+ return head($new);
+ } else {
+ return null;
+ }
+ }
+
if (!$this->getUseEdgeTransactions()) {
return $new;
}
@@ -68,7 +92,13 @@
return new PhabricatorEdgeEditType();
}
- return parent::newEditType();
+ $type = parent::newEditType();
+
+ if ($this->getIsSingleValue()) {
+ $type->setValueType('phid');
+ }
+
+ return $type;
}
public function getConduitEditTypes() {
diff --git a/src/applications/transactions/editfield/PhabricatorTokenizerEditField.php b/src/applications/transactions/editfield/PhabricatorTokenizerEditField.php
--- a/src/applications/transactions/editfield/PhabricatorTokenizerEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorTokenizerEditField.php
@@ -25,6 +25,10 @@
$control->setOriginalValue($initial_value);
}
+ if ($this->getIsSingleValue()) {
+ $control->setLimit(1);
+ }
+
return $control;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 20, 10:43 PM (17 h, 45 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6908908
Default Alt Text
D14666.diff (3 KB)

Event Timeline