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

Remove vestigal AuxiliaryField code from Maniphest

Summary: Gets rid of as much of this as possible. We'll batch handles and remarkup again some day, but after ApplicationTransactions.

Test Plan: Edited, viewed, and checked email for custom field edits.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+9 -732
-7
src/__phutil_library_map__.php
··· 685 685 'LiskMigrationIterator' => 'infrastructure/storage/lisk/LiskMigrationIterator.php', 686 686 'LiskRawMigrationIterator' => 'infrastructure/storage/lisk/LiskRawMigrationIterator.php', 687 687 'ManiphestAction' => 'applications/maniphest/constants/ManiphestAction.php', 688 - 'ManiphestAuxiliaryFieldDefaultSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php', 689 688 'ManiphestAuxiliaryFieldSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php', 690 689 'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php', 691 690 'ManiphestConfiguredCustomField' => 'applications/maniphest/field/ManiphestConfiguredCustomField.php', ··· 2759 2758 'LiskMigrationIterator' => 'PhutilBufferedIterator', 2760 2759 'LiskRawMigrationIterator' => 'PhutilBufferedIterator', 2761 2760 'ManiphestAction' => 'ManiphestConstants', 2762 - 'ManiphestAuxiliaryFieldDefaultSpecification' => 'ManiphestAuxiliaryFieldSpecification', 2763 - 'ManiphestAuxiliaryFieldSpecification' => 2764 - array( 2765 - 0 => 'ManiphestCustomField', 2766 - 1 => 'PhabricatorMarkupInterface', 2767 - ), 2768 2761 'ManiphestBatchEditController' => 'ManiphestController', 2769 2762 'ManiphestConfiguredCustomField' => 2770 2763 array(
-463
src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php
··· 1 - <?php 2 - 3 - /** 4 - * @group maniphest 5 - */ 6 - class ManiphestAuxiliaryFieldDefaultSpecification 7 - extends ManiphestAuxiliaryFieldSpecification { 8 - 9 - private $required; 10 - private $fieldType; 11 - 12 - private $selectOptions; 13 - private $checkboxLabel; 14 - private $checkboxValue; 15 - private $error; 16 - private $shouldCopyWhenCreatingSimilarTask; 17 - 18 - const TYPE_SELECT = 'select'; 19 - const TYPE_STRING = 'string'; 20 - const TYPE_INT = 'int'; 21 - const TYPE_BOOL = 'bool'; 22 - const TYPE_DATE = 'date'; 23 - const TYPE_REMARKUP = 'remarkup'; 24 - const TYPE_USER = 'user'; 25 - const TYPE_USERS = 'users'; 26 - const TYPE_HEADER = 'header'; 27 - 28 - public function createFields() { 29 - return array(); 30 - } 31 - 32 - public function getFieldType() { 33 - return $this->fieldType; 34 - } 35 - 36 - public function setFieldType($val) { 37 - $this->fieldType = $val; 38 - return $this; 39 - } 40 - 41 - public function getError() { 42 - return $this->error; 43 - } 44 - 45 - public function setError($val) { 46 - $this->error = $val; 47 - return $this; 48 - } 49 - 50 - public function getSelectOptions() { 51 - return $this->selectOptions; 52 - } 53 - 54 - public function setSelectOptions($array) { 55 - $this->selectOptions = $array; 56 - return $this; 57 - } 58 - 59 - public function setRequired($bool) { 60 - $this->required = $bool; 61 - return $this; 62 - } 63 - 64 - public function isRequired() { 65 - return $this->required; 66 - } 67 - 68 - public function setCheckboxLabel($checkbox_label) { 69 - $this->checkboxLabel = $checkbox_label; 70 - return $this; 71 - } 72 - 73 - public function getCheckboxLabel() { 74 - return $this->checkboxLabel; 75 - } 76 - 77 - public function setCheckboxValue($checkbox_value) { 78 - $this->checkboxValue = $checkbox_value; 79 - return $this; 80 - } 81 - 82 - public function getCheckboxValue() { 83 - return $this->checkboxValue; 84 - } 85 - 86 - public function renderEditControl() { 87 - $control = null; 88 - 89 - $type = $this->getFieldType(); 90 - switch ($type) { 91 - case self::TYPE_INT: 92 - $control = new AphrontFormTextControl(); 93 - break; 94 - case self::TYPE_STRING: 95 - $control = new AphrontFormTextControl(); 96 - break; 97 - case self::TYPE_SELECT: 98 - $control = new AphrontFormSelectControl(); 99 - $control->setOptions($this->getSelectOptions()); 100 - break; 101 - case self::TYPE_BOOL: 102 - $control = new AphrontFormCheckboxControl(); 103 - break; 104 - case self::TYPE_DATE: 105 - $control = new AphrontFormDateControl(); 106 - $control->setUser($this->getUser()); 107 - if (!$this->isRequired()) { 108 - $control->setAllowNull(true); 109 - } 110 - break; 111 - case self::TYPE_REMARKUP: 112 - $control = new PhabricatorRemarkupControl(); 113 - $control->setUser($this->getUser()); 114 - break; 115 - case self::TYPE_USER: 116 - case self::TYPE_USERS: 117 - $control = new AphrontFormTokenizerControl(); 118 - $control->setDatasource('/typeahead/common/users/'); 119 - if ($type == self::TYPE_USER) { 120 - $control->setLimit(1); 121 - } 122 - break; 123 - case self::TYPE_HEADER: 124 - $control = new AphrontFormMarkupControl(); 125 - break; 126 - default: 127 - $label = $this->getLabel(); 128 - throw new Exception( 129 - "Field type '{$type}' is not a valid type (for field '{$label}')."); 130 - break; 131 - } 132 - 133 - switch ($type) { 134 - case self::TYPE_BOOL: 135 - $control->addCheckbox( 136 - 'auxiliary['.$this->getAuxiliaryKey().']', 137 - 1, 138 - $this->getCheckboxLabel(), 139 - (bool)$this->getValue()); 140 - break; 141 - case self::TYPE_DATE: 142 - if ($this->getValue() > 0) { 143 - $control->setValue($this->getValue()); 144 - } 145 - $control->setName('auxiliary_date_'.$this->getAuxiliaryKey()); 146 - break; 147 - case self::TYPE_USER: 148 - case self::TYPE_USERS: 149 - $control->setName('auxiliary_tokenizer_'.$this->getAuxiliaryKey()); 150 - $value = array(); 151 - foreach ($this->getValue() as $phid) { 152 - $value[$phid] = $this->getHandle($phid)->getFullName(); 153 - } 154 - $control->setValue($value); 155 - break; 156 - case self::TYPE_HEADER: 157 - $control->setValue( 158 - phutil_tag( 159 - 'h2', 160 - array( 161 - 'class' => 'maniphest-auxiliary-header', 162 - ), 163 - $this->getLabel())); 164 - break; 165 - default: 166 - $control->setValue($this->getValue()); 167 - $control->setName('auxiliary['.$this->getAuxiliaryKey().']'); 168 - break; 169 - } 170 - 171 - switch ($type) { 172 - case self::TYPE_HEADER: 173 - break; 174 - default: 175 - $control->setLabel($this->getLabel()); 176 - $control->setCaption($this->getCaption()); 177 - $control->setError($this->getError()); 178 - break; 179 - } 180 - 181 - $stripped_auxiliary_key = preg_replace( 182 - '/[\w\d\.\-\:]+/', '', $this->getAuxiliaryKey()); 183 - 184 - if (strlen($stripped_auxiliary_key)) { 185 - $unique_key_chars = array_unique(str_split($stripped_auxiliary_key)); 186 - $unique_key_chars = implode(" ,", $unique_key_chars); 187 - $control->setDisabled(true); 188 - $control->setCaption( 189 - "This control is not configured correctly, the key must only contain 190 - ( a-z, A-Z, 0-9, ., -, : ) but has ( {$unique_key_chars} ), so it can 191 - not be rendered, go fix your config."); 192 - } 193 - 194 - return $control; 195 - } 196 - 197 - public function setValueFromRequest(AphrontRequest $request) { 198 - $type = $this->getFieldType(); 199 - switch ($type) { 200 - case self::TYPE_DATE: 201 - $control = $this->renderEditControl(); 202 - $value = $control->readValueFromRequest($request); 203 - break; 204 - case self::TYPE_USER: 205 - case self::TYPE_USERS: 206 - $name = 'auxiliary_tokenizer_'.$this->getAuxiliaryKey(); 207 - $value = $request->getArr($name); 208 - if ($type == self::TYPE_USER) { 209 - $value = array_slice($value, 0, 1); 210 - } 211 - break; 212 - default: 213 - $aux_post_values = $request->getArr('auxiliary'); 214 - $value = idx($aux_post_values, $this->getAuxiliaryKey(), ''); 215 - break; 216 - } 217 - return $this->setValue($value); 218 - } 219 - 220 - public function getValueForStorage() { 221 - switch ($this->getFieldType()) { 222 - case self::TYPE_USER: 223 - case self::TYPE_USERS: 224 - return json_encode($this->getValue()); 225 - case self::TYPE_DATE: 226 - return (int)$this->getValue(); 227 - default: 228 - return $this->getValue(); 229 - } 230 - } 231 - 232 - public function setValueFromStorage($value) { 233 - switch ($this->getFieldType()) { 234 - case self::TYPE_USER: 235 - case self::TYPE_USERS: 236 - $value = json_decode($value, true); 237 - if (!is_array($value)) { 238 - $value = array(); 239 - } 240 - break; 241 - case self::TYPE_DATE: 242 - $value = (int)$value; 243 - $this->setDefaultValue($value); 244 - break; 245 - default: 246 - break; 247 - } 248 - return $this->setValue($value); 249 - } 250 - 251 - public function validateApplicationTransactions( 252 - PhabricatorApplicationTransactionEditor $editor, 253 - $type, 254 - array $xactions) { 255 - 256 - $errors = parent::validateApplicationTransactions( 257 - $editor, 258 - $type, 259 - $xactions); 260 - 261 - $has_value = false; 262 - $value = null; 263 - foreach ($xactions as $xaction) { 264 - $has_value = true; 265 - $value = $xaction->getNewValue(); 266 - switch ($this->getFieldType()) { 267 - case self::TYPE_INT: 268 - if ($value && !is_numeric($value)) { 269 - $errors[] = new PhabricatorApplicationTransactionValidationError( 270 - $type, 271 - pht('Invalid'), 272 - pht('%s must be an integer value.', $this->getLabel()), 273 - $xaction); 274 - $this->setError(pht('Invalid')); 275 - } 276 - break; 277 - case self::TYPE_DATE: 278 - if ((int)$value <= 0 && $this->isRequired()) { 279 - $errors[] = new PhabricatorApplicationTransactionValidationError( 280 - $type, 281 - pht('Invalid'), 282 - pht('%s must be a valid date.', $this->getLabel()), 283 - $xaction); 284 - $this->setError(pht('Invalid')); 285 - } 286 - break; 287 - } 288 - } 289 - 290 - if ($this->isRequired()) { 291 - if (!$has_value) { 292 - $value = $this->getOldValueForApplicationTransactions(); 293 - } 294 - if (!$value) { 295 - $errors[] = new PhabricatorApplicationTransactionValidationError( 296 - $type, 297 - pht('Required'), 298 - pht('%s is required.', $this->getLabel()), 299 - null); 300 - $this->setError(pht('Required')); 301 - } 302 - } 303 - 304 - return $errors; 305 - } 306 - 307 - public function setDefaultValue($value) { 308 - switch ($this->getFieldType()) { 309 - case self::TYPE_DATE: 310 - $value = strtotime($value); 311 - if ($value <= 0) { 312 - $value = time(); 313 - } 314 - $this->setValue($value); 315 - break; 316 - case self::TYPE_USER: 317 - case self::TYPE_USERS: 318 - if (!is_array($value)) { 319 - $value = array(); 320 - } else { 321 - $value = array_values($value); 322 - } 323 - $this->setValue($value); 324 - break; 325 - default: 326 - $this->setValue((string)$value); 327 - break; 328 - } 329 - } 330 - 331 - public function getMarkupFields() { 332 - switch ($this->getFieldType()) { 333 - case self::TYPE_REMARKUP: 334 - return array('default'); 335 - } 336 - return parent::getMarkupFields(); 337 - } 338 - 339 - public function renderForDetailView() { 340 - switch ($this->getFieldType()) { 341 - case self::TYPE_BOOL: 342 - if ($this->getValue()) { 343 - return $this->getCheckboxValue(); 344 - } else { 345 - return null; 346 - } 347 - case self::TYPE_SELECT: 348 - return idx($this->getSelectOptions(), $this->getValue()); 349 - case self::TYPE_DATE: 350 - return phabricator_datetime($this->getValue(), $this->getUser()); 351 - case self::TYPE_REMARKUP: 352 - return $this->getMarkupEngine()->getOutput( 353 - $this, 354 - 'default'); 355 - case self::TYPE_USER: 356 - case self::TYPE_USERS: 357 - return $this->renderHandleList($this->getValue()); 358 - case self::TYPE_HEADER: 359 - return phutil_tag('hr'); 360 - } 361 - return parent::renderForDetailView(); 362 - } 363 - 364 - public function getRequiredHandlePHIDs() { 365 - switch ($this->getFieldType()) { 366 - case self::TYPE_USER; 367 - case self::TYPE_USERS: 368 - return $this->getValue(); 369 - } 370 - return parent::getRequiredHandlePHIDs(); 371 - } 372 - 373 - protected function renderHandleList(array $phids) { 374 - $links = array(); 375 - foreach ($phids as $phid) { 376 - $links[] = $this->getHandle($phid)->renderLink(); 377 - } 378 - return phutil_implode_html(', ', $links); 379 - } 380 - 381 - public function renderTransactionDescription( 382 - ManiphestTransaction $transaction, 383 - $target) { 384 - 385 - $label = $this->getLabel(); 386 - $old = $transaction->getOldValue(); 387 - $new = $transaction->getNewValue(); 388 - 389 - switch ($this->getFieldType()) { 390 - case self::TYPE_BOOL: 391 - if ($new) { 392 - $desc = "set field '{$label}' true"; 393 - } else { 394 - $desc = "set field '{$label}' false"; 395 - } 396 - break; 397 - case self::TYPE_SELECT: 398 - $old_display = idx($this->getSelectOptions(), $old); 399 - $new_display = idx($this->getSelectOptions(), $new); 400 - if ($old === null) { 401 - $desc = "set field '{$label}' to '{$new_display}'"; 402 - } else { 403 - $desc = "changed field '{$label}' ". 404 - "from '{$old_display}' to '{$new_display}'"; 405 - } 406 - break; 407 - case self::TYPE_DATE: 408 - // NOTE: Although it should be impossible to get bad data in these 409 - // fields normally, users can change the type of an existing field and 410 - // leave us with uninterpretable data in old transactions. 411 - if ((int)$new <= 0) { 412 - $new_display = "none"; 413 - } else { 414 - $new_display = phabricator_datetime($new, $this->getUser()); 415 - } 416 - if ($old === null) { 417 - $desc = "set field '{$label}' to '{$new_display}'"; 418 - } else { 419 - if ((int)$old <= 0) { 420 - $old_display = "none"; 421 - } else { 422 - $old_display = phabricator_datetime($old, $this->getUser()); 423 - } 424 - $desc = "changed field '{$label}' ". 425 - "from '{$old_display}' to '{$new_display}'"; 426 - } 427 - break; 428 - case self::TYPE_REMARKUP: 429 - // TODO: After we get ApplicationTransactions, straighten this out. 430 - $desc = "updated field '{$label}'"; 431 - break; 432 - case self::TYPE_USER: 433 - case self::TYPE_USERS: 434 - // TODO: As above, this is a mess that should get straightened out, 435 - // but it will be easier after T2217. 436 - $desc = "updated field '{$label}'"; 437 - break; 438 - default: 439 - if (!strlen($old)) { 440 - if (!strlen($new)) { 441 - return null; 442 - } 443 - $desc = "set field '{$label}' to '{$new}'"; 444 - } else { 445 - $desc = "updated '{$label}' ". 446 - "from '{$old}' to '{$new}'"; 447 - } 448 - break; 449 - } 450 - 451 - return $desc; 452 - } 453 - 454 - public function setShouldCopyWhenCreatingSimilarTask($copy) { 455 - $this->shouldCopyWhenCreatingSimilarTask = $copy; 456 - return $this; 457 - } 458 - 459 - public function shouldCopyWhenCreatingSimilarTask() { 460 - return $this->shouldCopyWhenCreatingSimilarTask; 461 - } 462 - 463 - }
+2 -181
src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php
··· 1 1 <?php 2 2 3 3 /** 4 - * @group maniphest 4 + * TODO: Destroy after ApplicationTransactions. 5 5 */ 6 - abstract class ManiphestAuxiliaryFieldSpecification 7 - extends ManiphestCustomField 8 - implements PhabricatorMarkupInterface { 9 - 10 - const RENDER_TARGET_HTML = 'html'; 11 - const RENDER_TARGET_TEXT = 'text'; 12 - 13 - private $label; 14 - private $auxiliaryKey; 15 - private $caption; 16 - private $value; 17 - private $markupEngine; 18 - private $handles; 19 - 20 - // TODO: Remove; obsolete. 21 - public function getTask() { 22 - return $this->getObject(); 23 - } 24 - 25 - // TODO: Remove; obsolete. 26 - public function getUser() { 27 - return $this->getViewer(); 28 - } 29 - 30 - public function setLabel($val) { 31 - $this->label = $val; 32 - return $this; 33 - } 34 - 35 - public function getLabel() { 36 - return $this->label; 37 - } 38 - 39 - public function setAuxiliaryKey($val) { 40 - $this->auxiliaryKey = $val; 41 - return $this; 42 - } 43 - 44 - public function getAuxiliaryKey() { 45 - return 'std:maniphest:'.$this->auxiliaryKey; 46 - } 47 - 48 - public function setCaption($val) { 49 - $this->caption = $val; 50 - return $this; 51 - } 52 - 53 - public function getCaption() { 54 - return $this->caption; 55 - } 56 - 57 - public function setValue($val) { 58 - $this->value = $val; 59 - return $this; 60 - } 61 - 62 - public function getValue() { 63 - return $this->value; 64 - } 65 - 66 - public function isRequired() { 67 - return false; 68 - } 69 - 70 - public function setType($val) { 71 - $this->type = $val; 72 - return $this; 73 - } 74 - 75 - public function getType() { 76 - return $this->type; 77 - } 78 - 79 - public function renderForDetailView() { 80 - return $this->getValue(); 81 - } 82 - 83 - public function getRequiredHandlePHIDs() { 84 - return array(); 85 - } 86 - 87 - public function setHandles(array $handles) { 88 - assert_instances_of($handles, 'PhabricatorObjectHandle'); 89 - $this->handles = array_select_keys( 90 - $handles, 91 - $this->getRequiredHandlePHIDs()); 92 - return $this; 93 - } 94 - 95 - public function getHandle($phid) { 96 - if (empty($this->handles[$phid])) { 97 - throw new Exception( 98 - "Field is requesting a handle ('{$phid}') it did not require."); 99 - } 100 - return $this->handles[$phid]; 101 - } 102 - 103 - public function getMarkupFields() { 104 - return array(); 105 - } 106 - 107 - public function setMarkupEngine(PhabricatorMarkupEngine $engine) { 108 - $this->markupEngine = $engine; 109 - return $this; 110 - } 111 - 112 - public function getMarkupEngine() { 113 - return $this->markupEngine; 114 - } 115 - 116 - 117 - /* -( PhabricatorMarkupInterface )----------------------------------------- */ 118 - 119 - 120 - public function getMarkupFieldKey($field) { 121 - $hash = PhabricatorHash::digestForIndex($this->getMarkupText($field)); 122 - return 'maux:'.$this->getAuxiliaryKey().':'.$hash; 123 - } 124 - 125 - 126 - public function newMarkupEngine($field) { 127 - return PhabricatorMarkupEngine::newManiphestMarkupEngine(); 128 - } 129 - 130 - 131 - public function getMarkupText($field) { 132 - return $this->getValue(); 133 - } 134 - 135 - public function didMarkupText( 136 - $field, 137 - $output, 138 - PhutilMarkupEngine $engine) { 139 - return phutil_tag( 140 - 'div', 141 - array( 142 - 'class' => 'phabricator-remarkup', 143 - ), 144 - $output); 145 - } 146 - 147 - public function shouldUseMarkupCache($field) { 148 - return true; 149 - } 150 - 151 - 152 - /* -( API Compatibility With New Custom Fields )--------------------------- */ 153 - 154 - 155 - public function getFieldKey() { 156 - return $this->getAuxiliaryKey(); 157 - } 158 - 159 - public function shouldAppearInEditView() { 160 - return true; 161 - } 162 - 163 - public function shouldAppearInPropertyView() { 164 - return true; 165 - } 166 - 167 - public function shouldUseStorage() { 168 - return true; 169 - } 170 - 171 - public function renderPropertyViewValue() { 172 - $value = $this->renderForDetailView(); 173 - if (!strlen($value)) { 174 - return null; 175 - } 176 - return $value; 177 - } 178 - 179 - public function renderPropertyViewLabel() { 180 - return $this->getLabel(); 181 - } 182 - 183 - public function readValueFromRequest(AphrontRequest $request) { 184 - return $this->setValueFromRequest($request); 185 - } 6 + final class ManiphestAuxiliaryFieldSpecification { 186 7 187 8 public static function writeLegacyAuxiliaryUpdates( 188 9 ManiphestTask $task,
-14
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 98 98 99 99 $phids = array_keys($phids); 100 100 101 - $phids = array_merge( 102 - $phids, 103 - array_mergev(mpull($aux_fields, 'getRequiredHandlePHIDs'))); 104 - 105 101 $this->loadHandles($phids); 106 102 107 103 $handles = $this->getLoadedHandles(); 108 - foreach ($aux_fields as $aux_field) { 109 - $aux_field->setHandles($handles); 110 - } 111 104 112 105 $context_bar = null; 113 106 ··· 149 142 foreach ($transactions as $xaction) { 150 143 if ($xaction->hasComments()) { 151 144 $engine->addObject($xaction, ManiphestTransaction::MARKUP_FIELD_BODY); 152 - } 153 - } 154 - 155 - foreach ($aux_fields as $aux_field) { 156 - foreach ($aux_field->getMarkupFields() as $markup_field) { 157 - $engine->addObject($aux_field, $markup_field); 158 - $aux_field->setMarkupEngine($engine); 159 145 } 160 146 } 161 147
+1 -6
src/applications/maniphest/controller/ManiphestTaskEditController.php
··· 354 354 $phids = array_merge( 355 355 array($task->getOwnerPHID()), 356 356 $task->getCCPHIDs(), 357 - $task->getProjectPHIDs(), 358 - array_mergev(mpull($aux_fields, 'getRequiredHandlePHIDs'))); 357 + $task->getProjectPHIDs()); 359 358 360 359 if ($parent_task) { 361 360 $phids[] = $parent_task->getPHID(); ··· 365 364 $phids = array_unique($phids); 366 365 367 366 $handles = $this->loadViewerHandles($phids); 368 - 369 - foreach ($aux_fields as $aux_field) { 370 - $aux_field->setHandles($handles); 371 - } 372 367 373 368 $tvalues = mpull($handles, 'getFullName', 'getPHID'); 374 369
+4 -51
src/applications/maniphest/field/ManiphestCustomField.php
··· 28 28 return false; 29 29 } 30 30 31 + 31 32 // TODO: All of this is legacy junk. 32 - public function getRequiredHandlePHIDs() { 33 - return array(); 34 - } 35 - 36 - public function setHandles(array $handles) { 37 - } 38 33 39 - /** 40 - * Render a verb to appear in email titles when a transaction involving this 41 - * field occurs. Specifically, Maniphest emails are formatted like this: 42 - * 43 - * [Maniphest] [Verb Here] TNNN: Task title here 44 - * ^^^^^^^^^ 45 - * 46 - * You should optionally return a title-case verb or short phrase like 47 - * "Created", "Retitled", "Closed", "Resolved", "Commented On", 48 - * "Lowered Priority", etc., which describes the transaction. 49 - * 50 - * @param ManiphestTransaction The transaction which needs description. 51 - * @return string|null A short description of the transaction. 52 - */ 53 34 public function renderTransactionEmailVerb( 54 35 ManiphestTransaction $transaction) { 55 36 return null; 56 37 } 57 38 58 - 59 - /** 60 - * Render a short description of the transaction, to appear above comments 61 - * in the Maniphest transaction log. The string will be rendered after the 62 - * acting user's name. Examples are: 63 - * 64 - * added a comment 65 - * added alincoln to CC 66 - * claimed this task 67 - * created this task 68 - * closed this task out of spite 69 - * 70 - * You should return a similar string, describing the transaction. 71 - * 72 - * Note the ##$target## parameter -- Maniphest needs to render transaction 73 - * descriptions for different targets, like web and email. This method will 74 - * be called with a ##ManiphestAuxiliaryFieldSpecification::RENDER_TARGET_*## 75 - * constant describing the intended target. 76 - * 77 - * @param ManiphestTransaction The transaction which needs description. 78 - * @param const Constant describing the rendering target (e.g., html or text). 79 - * @return string|null Description of the transaction. 80 - */ 81 39 public function renderTransactionDescription( 82 - ManiphestTransaction $transaction, 83 - $target) { 40 + ManiphestTransaction $transaction) { 84 41 $old = $transaction->getOldValue(); 85 42 $new = $transaction->getNewValue(); 86 43 return pht( 87 44 'updated field %s from %s to %s', 88 45 $this->getFieldName(), 89 - $old, 90 - $new); 91 - } 92 - 93 - public function getMarkupFields() { 94 - return array(); 46 + hsprintf('%s', $old), 47 + hsprintf('%s', $new)); 95 48 } 96 49 97 50 }
+2 -10
src/applications/maniphest/view/ManiphestTransactionDetailView.php
··· 541 541 542 542 $desc = null; 543 543 if ($aux_field) { 544 - $use_field = $aux_field; 544 + $desc = $aux_field->renderTransactionDescription($transaction); 545 545 } else { 546 - $use_field = id(new ManiphestAuxiliaryFieldDefaultSpecification()) 547 - ->setFieldType( 548 - ManiphestAuxiliaryFieldDefaultSpecification::TYPE_STRING); 546 + $desc = 'updated a field'; 549 547 } 550 - 551 - $desc = $use_field->renderTransactionDescription( 552 - $transaction, 553 - $this->forEmail 554 - ? ManiphestAuxiliaryFieldSpecification::RENDER_TARGET_TEXT 555 - : ManiphestAuxiliaryFieldSpecification::RENDER_TARGET_HTML); 556 548 557 549 break; 558 550 default: