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

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

+50 -46
+1
src/applications/maniphest/editor/ManiphestEditEngine.php
··· 189 189 ->setKey('owner') 190 190 ->setAliases(array('ownerPHID', 'assign', 'assigned')) 191 191 ->setLabel(pht('Assigned To')) 192 + ->setBulkEditLabel(pht('Assign to')) 192 193 ->setDescription(pht('User who is responsible for the task.')) 193 194 ->setConduitDescription(pht('Reassign the task.')) 194 195 ->setConduitTypeDescription(
-2
src/applications/transactions/editengine/PhabricatorEditEngine.php
··· 2219 2219 } 2220 2220 2221 2221 foreach ($field_types as $field_type) { 2222 - $field_type->setField($field); 2223 2222 $types[$field_type->getEditType()] = $field_type; 2224 2223 } 2225 2224 } ··· 2523 2522 } 2524 2523 2525 2524 foreach ($field_types as $field_type) { 2526 - $field_type->setField($field); 2527 2525 $types[$field_type->getEditType()] = $field_type; 2528 2526 } 2529 2527 }
+22 -28
src/applications/transactions/editfield/PhabricatorEditField.php
··· 681 681 } 682 682 683 683 protected function newEditType() { 684 - $parameter_type = $this->getConduitParameterType(); 685 - if (!$parameter_type) { 686 - return null; 687 - } 688 - 689 - $edit_type = id(new PhabricatorSimpleEditType()) 690 - ->setConduitParameterType($parameter_type); 691 - 692 - $bulk_type = $this->getBulkParameterType(); 693 - if ($bulk_type) { 694 - $edit_type->setBulkParameterType($bulk_type); 695 - } 696 - 697 - return $edit_type; 684 + return new PhabricatorSimpleEditType(); 698 685 } 699 686 700 687 protected function getEditType() { 701 688 $transaction_type = $this->getTransactionType(); 702 - 703 689 if ($transaction_type === null) { 704 690 return null; 705 691 } 706 692 707 - $type_key = $this->getEditTypeKey(); 708 693 $edit_type = $this->newEditType(); 709 694 if (!$edit_type) { 710 695 return null; 711 696 } 712 697 713 - return $edit_type 714 - ->setEditType($type_key) 698 + $type_key = $this->getEditTypeKey(); 699 + 700 + $edit_type 701 + ->setEditField($this) 715 702 ->setTransactionType($transaction_type) 703 + ->setEditType($type_key) 716 704 ->setMetadata($this->getMetadata()); 705 + 706 + if (!$edit_type->getConduitParameterType()) { 707 + $conduit_parameter = $this->getConduitParameterType(); 708 + if ($conduit_parameter) { 709 + $edit_type->setConduitParameterType($conduit_parameter); 710 + } 711 + } 712 + 713 + if (!$edit_type->getBulkParameterType()) { 714 + $bulk_parameter = $this->getBulkParameterType(); 715 + if ($bulk_parameter) { 716 + $edit_type->setBulkParameterType($bulk_parameter); 717 + } 718 + } 719 + 720 + return $edit_type; 717 721 } 718 722 719 723 final public function getConduitEditTypes() { 720 724 if ($this->conduitEditTypes === null) { 721 725 $edit_types = $this->newConduitEditTypes(); 722 726 $edit_types = mpull($edit_types, null, 'getEditType'); 723 - 724 - foreach ($edit_types as $edit_type) { 725 - $edit_type->setEditField($this); 726 - } 727 - 728 727 $this->conduitEditTypes = $edit_types; 729 728 } 730 729 ··· 758 757 if ($this->bulkEditTypes === null) { 759 758 $edit_types = $this->newBulkEditTypes(); 760 759 $edit_types = mpull($edit_types, null, 'getEditType'); 761 - 762 - foreach ($edit_types as $edit_type) { 763 - $edit_type->setEditField($this); 764 - } 765 - 766 760 $this->bulkEditTypes = $edit_types; 767 761 } 768 762
+2 -4
src/applications/transactions/editfield/PhabricatorPHIDListEditField.php
··· 98 98 return new PhabricatorEdgeEditType(); 99 99 } 100 100 101 - $type = new PhabricatorDatasourceEditType(); 102 - $type->setIsSingleValue($this->getIsSingleValue()); 103 - $type->setConduitParameterType($this->newConduitParameterType()); 104 - return $type; 101 + return id(new PhabricatorDatasourceEditType()) 102 + ->setIsSingleValue($this->getIsSingleValue()); 105 103 } 106 104 107 105 protected function newBulkEditTypes() {
+8
src/applications/transactions/editfield/PhabricatorTokenizerEditField.php
··· 56 56 return $action; 57 57 } 58 58 59 + protected function newBulkParameterType() { 60 + $datasource = $this->newDatasource() 61 + ->setViewer($this->getViewer()); 62 + 63 + return id(new BulkTokenizerParameterType()) 64 + ->setDatasource($datasource); 65 + } 66 + 59 67 }
+16
src/applications/transactions/edittype/PhabricatorDatasourceEditType.php
··· 19 19 return '?'; 20 20 } 21 21 22 + public function newRawBulkTransaction(array $xaction) { 23 + $value = idx($xaction, 'value'); 24 + 25 + if ($this->getIsSingleValue()) { 26 + if ($value) { 27 + $value = head($value); 28 + } else { 29 + $value = null; 30 + } 31 + 32 + $xaction['value'] = $value; 33 + } 34 + 35 + return $xaction; 36 + } 37 + 22 38 }
-1
src/applications/transactions/edittype/PhabricatorEdgeEditType.php
··· 43 43 ->setDatasource($this->getDatasource()); 44 44 } 45 45 46 - 47 46 public function newRawBulkTransaction(array $xaction) { 48 47 $value = idx($xaction, 'value'); 49 48
+1 -11
src/applications/transactions/edittype/PhabricatorEditType.php
··· 6 6 private $editField; 7 7 private $transactionType; 8 8 private $label; 9 - private $field; 10 9 private $metadata = array(); 11 10 12 11 private $conduitDescription; ··· 36 35 return $this->bulkEditLabel; 37 36 } 38 37 39 - return $this->getField()->getBulkEditLabel(); 40 - } 41 - 42 - public function setField(PhabricatorEditField $field) { 43 - $this->field = $field; 44 - return $this; 45 - } 46 - 47 - public function getField() { 48 - return $this->field; 38 + return $this->getEditField()->getBulkEditLabel(); 49 39 } 50 40 51 41 public function setEditType($edit_type) {