mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Support "Assign To" in Maniphest bulk editor
Summary: Ref T13025. See PHI173. This supports the "Assign to" field in the new editor. This is very slightly funky: to unassign tasks, you need to leave the field blank. I have half a diff to fix this, but the way the `none()` token works in the default datasource is odd so it needs a separate datasource. I'm punting on this for now since it works, at least, and isn't //completely// unreasonable. This also simplifies some EditEngine stuff a little. Notably: - I reorganized EditType construction slightly so subclasses can copy/paste a little bit less. - EditType had `field` and `editField` properties which had the same values. I canonicalized on `editField` and made this value set a little more automatically. Test Plan: Used bulk editor to reassign some tasks. By leaving the field blank, unassigned tasks. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13025 Differential Revision: https://secure.phabricator.com/D18874
This commit is contained in:
parent
0cad6021b6
commit
91a78db99b
8 changed files with 50 additions and 46 deletions
|
@ -189,6 +189,7 @@ EODOCS
|
||||||
->setKey('owner')
|
->setKey('owner')
|
||||||
->setAliases(array('ownerPHID', 'assign', 'assigned'))
|
->setAliases(array('ownerPHID', 'assign', 'assigned'))
|
||||||
->setLabel(pht('Assigned To'))
|
->setLabel(pht('Assigned To'))
|
||||||
|
->setBulkEditLabel(pht('Assign to'))
|
||||||
->setDescription(pht('User who is responsible for the task.'))
|
->setDescription(pht('User who is responsible for the task.'))
|
||||||
->setConduitDescription(pht('Reassign the task.'))
|
->setConduitDescription(pht('Reassign the task.'))
|
||||||
->setConduitTypeDescription(
|
->setConduitTypeDescription(
|
||||||
|
|
|
@ -2219,7 +2219,6 @@ abstract class PhabricatorEditEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($field_types as $field_type) {
|
foreach ($field_types as $field_type) {
|
||||||
$field_type->setField($field);
|
|
||||||
$types[$field_type->getEditType()] = $field_type;
|
$types[$field_type->getEditType()] = $field_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2523,7 +2522,6 @@ abstract class PhabricatorEditEngine
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($field_types as $field_type) {
|
foreach ($field_types as $field_type) {
|
||||||
$field_type->setField($field);
|
|
||||||
$types[$field_type->getEditType()] = $field_type;
|
$types[$field_type->getEditType()] = $field_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -681,50 +681,49 @@ abstract class PhabricatorEditField extends Phobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function newEditType() {
|
protected function newEditType() {
|
||||||
$parameter_type = $this->getConduitParameterType();
|
return new PhabricatorSimpleEditType();
|
||||||
if (!$parameter_type) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$edit_type = id(new PhabricatorSimpleEditType())
|
|
||||||
->setConduitParameterType($parameter_type);
|
|
||||||
|
|
||||||
$bulk_type = $this->getBulkParameterType();
|
|
||||||
if ($bulk_type) {
|
|
||||||
$edit_type->setBulkParameterType($bulk_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $edit_type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getEditType() {
|
protected function getEditType() {
|
||||||
$transaction_type = $this->getTransactionType();
|
$transaction_type = $this->getTransactionType();
|
||||||
|
|
||||||
if ($transaction_type === null) {
|
if ($transaction_type === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type_key = $this->getEditTypeKey();
|
|
||||||
$edit_type = $this->newEditType();
|
$edit_type = $this->newEditType();
|
||||||
if (!$edit_type) {
|
if (!$edit_type) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $edit_type
|
$type_key = $this->getEditTypeKey();
|
||||||
->setEditType($type_key)
|
|
||||||
|
$edit_type
|
||||||
|
->setEditField($this)
|
||||||
->setTransactionType($transaction_type)
|
->setTransactionType($transaction_type)
|
||||||
|
->setEditType($type_key)
|
||||||
->setMetadata($this->getMetadata());
|
->setMetadata($this->getMetadata());
|
||||||
|
|
||||||
|
if (!$edit_type->getConduitParameterType()) {
|
||||||
|
$conduit_parameter = $this->getConduitParameterType();
|
||||||
|
if ($conduit_parameter) {
|
||||||
|
$edit_type->setConduitParameterType($conduit_parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$edit_type->getBulkParameterType()) {
|
||||||
|
$bulk_parameter = $this->getBulkParameterType();
|
||||||
|
if ($bulk_parameter) {
|
||||||
|
$edit_type->setBulkParameterType($bulk_parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $edit_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function getConduitEditTypes() {
|
final public function getConduitEditTypes() {
|
||||||
if ($this->conduitEditTypes === null) {
|
if ($this->conduitEditTypes === null) {
|
||||||
$edit_types = $this->newConduitEditTypes();
|
$edit_types = $this->newConduitEditTypes();
|
||||||
$edit_types = mpull($edit_types, null, 'getEditType');
|
$edit_types = mpull($edit_types, null, 'getEditType');
|
||||||
|
|
||||||
foreach ($edit_types as $edit_type) {
|
|
||||||
$edit_type->setEditField($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->conduitEditTypes = $edit_types;
|
$this->conduitEditTypes = $edit_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -758,11 +757,6 @@ abstract class PhabricatorEditField extends Phobject {
|
||||||
if ($this->bulkEditTypes === null) {
|
if ($this->bulkEditTypes === null) {
|
||||||
$edit_types = $this->newBulkEditTypes();
|
$edit_types = $this->newBulkEditTypes();
|
||||||
$edit_types = mpull($edit_types, null, 'getEditType');
|
$edit_types = mpull($edit_types, null, 'getEditType');
|
||||||
|
|
||||||
foreach ($edit_types as $edit_type) {
|
|
||||||
$edit_type->setEditField($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->bulkEditTypes = $edit_types;
|
$this->bulkEditTypes = $edit_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,10 +98,8 @@ abstract class PhabricatorPHIDListEditField
|
||||||
return new PhabricatorEdgeEditType();
|
return new PhabricatorEdgeEditType();
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = new PhabricatorDatasourceEditType();
|
return id(new PhabricatorDatasourceEditType())
|
||||||
$type->setIsSingleValue($this->getIsSingleValue());
|
->setIsSingleValue($this->getIsSingleValue());
|
||||||
$type->setConduitParameterType($this->newConduitParameterType());
|
|
||||||
return $type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function newBulkEditTypes() {
|
protected function newBulkEditTypes() {
|
||||||
|
|
|
@ -56,4 +56,12 @@ abstract class PhabricatorTokenizerEditField
|
||||||
return $action;
|
return $action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function newBulkParameterType() {
|
||||||
|
$datasource = $this->newDatasource()
|
||||||
|
->setViewer($this->getViewer());
|
||||||
|
|
||||||
|
return id(new BulkTokenizerParameterType())
|
||||||
|
->setDatasource($datasource);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,4 +19,20 @@ final class PhabricatorDatasourceEditType
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function newRawBulkTransaction(array $xaction) {
|
||||||
|
$value = idx($xaction, 'value');
|
||||||
|
|
||||||
|
if ($this->getIsSingleValue()) {
|
||||||
|
if ($value) {
|
||||||
|
$value = head($value);
|
||||||
|
} else {
|
||||||
|
$value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$xaction['value'] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $xaction;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,6 @@ final class PhabricatorEdgeEditType
|
||||||
->setDatasource($this->getDatasource());
|
->setDatasource($this->getDatasource());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function newRawBulkTransaction(array $xaction) {
|
public function newRawBulkTransaction(array $xaction) {
|
||||||
$value = idx($xaction, 'value');
|
$value = idx($xaction, 'value');
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ abstract class PhabricatorEditType extends Phobject {
|
||||||
private $editField;
|
private $editField;
|
||||||
private $transactionType;
|
private $transactionType;
|
||||||
private $label;
|
private $label;
|
||||||
private $field;
|
|
||||||
private $metadata = array();
|
private $metadata = array();
|
||||||
|
|
||||||
private $conduitDescription;
|
private $conduitDescription;
|
||||||
|
@ -36,16 +35,7 @@ abstract class PhabricatorEditType extends Phobject {
|
||||||
return $this->bulkEditLabel;
|
return $this->bulkEditLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getField()->getBulkEditLabel();
|
return $this->getEditField()->getBulkEditLabel();
|
||||||
}
|
|
||||||
|
|
||||||
public function setField(PhabricatorEditField $field) {
|
|
||||||
$this->field = $field;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getField() {
|
|
||||||
return $this->field;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setEditType($edit_type) {
|
public function setEditType($edit_type) {
|
||||||
|
|
Loading…
Reference in a new issue