@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 tokenizer custom fields in bulk editor

Summary:
Ref T13025. This allows custom tokenizer fields, like a "Owning Group" field, to be edited with the bulk editor.

See PHI173 for some context.

Test Plan: Edited a custom "Owner" field (a project tokenizer) with the bulk editor.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13025

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

+56 -8
+22 -8
src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php
··· 6 6 private $customField; 7 7 private $httpParameterType; 8 8 private $conduitParameterType; 9 + private $bulkParameterType; 9 10 10 11 public function setCustomField(PhabricatorCustomField $custom_field) { 11 12 $this->customField = $custom_field; ··· 36 37 return $this->conduitParameterType; 37 38 } 38 39 40 + public function setCustomFieldBulkParameterType( 41 + BulkParameterType $type) { 42 + $this->bulkParameterType = $type; 43 + return $this; 44 + } 45 + 46 + public function getCustomFieldBulkParameterType() { 47 + return $this->bulkParameterType; 48 + } 49 + 39 50 protected function buildControl() { 40 51 if ($this->getIsConduitOnly()) { 41 52 return null; ··· 51 62 } 52 63 53 64 protected function newEditType() { 54 - $type = id(new PhabricatorCustomFieldEditType()) 65 + return id(new PhabricatorCustomFieldEditType()) 55 66 ->setCustomField($this->getCustomField()); 56 - 57 - $conduit_type = $this->newConduitParameterType(); 58 - if ($conduit_type) { 59 - $type->setConduitParameterType($conduit_type); 60 - } 61 - 62 - return $type; 63 67 } 64 68 65 69 public function getValueForTransaction() { ··· 108 112 109 113 protected function newConduitParameterType() { 110 114 $type = $this->getCustomFieldConduitParameterType(); 115 + 116 + if ($type) { 117 + return clone $type; 118 + } 119 + 120 + return null; 121 + } 122 + 123 + protected function newBulkParameterType() { 124 + $type = $this->getCustomFieldBulkParameterType(); 111 125 112 126 if ($type) { 113 127 return clone $type;
+27
src/infrastructure/customfield/field/PhabricatorCustomField.php
··· 1119 1119 $field->setCustomFieldConduitParameterType($conduit_type); 1120 1120 } 1121 1121 1122 + $bulk_type = $this->getBulkParameterType(); 1123 + if ($bulk_type) { 1124 + $field->setCustomFieldBulkParameterType($bulk_type); 1125 + } 1126 + 1122 1127 return $field; 1123 1128 } 1124 1129 ··· 1132 1137 } else { 1133 1138 $conduit_only = false; 1134 1139 } 1140 + 1141 + $bulk_label = $this->getBulkEditLabel(); 1135 1142 1136 1143 return $this->newEditField() 1137 1144 ->setKey($this->getFieldKey()) 1138 1145 ->setEditTypeKey($this->getModernFieldKey()) 1139 1146 ->setLabel($this->getFieldName()) 1147 + ->setBulkEditLabel($bulk_label) 1140 1148 ->setDescription($this->getFieldDescription()) 1141 1149 ->setTransactionType($this->getApplicationTransactionType()) 1142 1150 ->setIsConduitOnly($conduit_only) 1143 1151 ->setValue($this->getNewValueForApplicationTransactions()); 1152 + } 1153 + 1154 + protected function getBulkEditLabel() { 1155 + if ($this->proxy) { 1156 + return $this->proxy->getBulkEditLabel(); 1157 + } 1158 + 1159 + return pht('Set "%s" to', $this->getFieldName()); 1160 + } 1161 + 1162 + public function getBulkParameterType() { 1163 + return $this->newBulkParameterType(); 1164 + } 1165 + 1166 + protected function newBulkParameterType() { 1167 + if ($this->proxy) { 1168 + return $this->proxy->newBulkParameterType(); 1169 + } 1170 + return null; 1144 1171 } 1145 1172 1146 1173 protected function getHTTPParameterType() {
+7
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldTokenizer.php
··· 65 65 return new ConduitPHIDListParameterType(); 66 66 } 67 67 68 + protected function newBulkParameterType() { 69 + $datasource = $this->getDatasource(); 70 + 71 + return id(new BulkTokenizerParameterType()) 72 + ->setDatasource($datasource); 73 + } 74 + 68 75 public function shouldAppearInHeraldActions() { 69 76 return true; 70 77 }