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

Run Maniphest batch edits through modern editor

Summary:
Ref T2217. Swaps batch edits to modern editor.

Also, fix some issues with required fields and viewers being required to render certain standard fields (notably, date).

Test Plan: Made various batch edits, verified they went through properly.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2217

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

+32 -11
+16 -11
src/applications/maniphest/controller/ManiphestBatchEditController.php
··· 22 22 23 23 if ($request->isFormPost() && is_array($actions)) { 24 24 foreach ($tasks as $task) { 25 + $field_list = PhabricatorCustomField::getObjectFields( 26 + $task, 27 + PhabricatorCustomField::ROLE_EDIT); 28 + $field_list->readFieldsFromStorage($task); 29 + 25 30 $xactions = $this->buildTransactions($actions, $task); 26 31 if ($xactions) { 27 - $editor = new ManiphestTransactionEditor(); 28 - $editor->setActor($user); 29 - $editor->applyTransactions($task, $xactions); 32 + // TODO: Set content source to "batch edit". 33 + 34 + $editor = id(new ManiphestTransactionEditorPro()) 35 + ->setActor($user) 36 + ->setContentSourceFromRequest($request) 37 + ->setContinueOnNoEffect(true) 38 + ->applyTransactions($task, $xactions); 30 39 } 31 40 } 32 41 ··· 296 305 $value_map[$type] = $value; 297 306 } 298 307 299 - $template = new ManiphestTransaction(); 300 - $template->setAuthorPHID($this->getRequest()->getUser()->getPHID()); 301 - 302 - // TODO: Set content source to "batch edit". 303 - 304 - $template->setContentSource( 305 - PhabricatorContentSource::newFromRequest($this->getRequest())); 308 + $template = new ManiphestTransactionPro(); 306 309 307 310 foreach ($value_map as $type => $value) { 308 311 $xaction = clone $template; ··· 310 313 311 314 switch ($type) { 312 315 case PhabricatorTransactions::TYPE_COMMENT: 313 - $xaction->setComments($value); 316 + $xaction->attachComment( 317 + id(new ManiphestTransactionComment()) 318 + ->setContent($value)); 314 319 break; 315 320 default: 316 321 $xaction->setNewValue($value);
+1
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 253 253 $main_body = array(); 254 254 foreach ($transactions as $transaction) { 255 255 $main_body[] = id(clone $transaction->getModernTransaction()) 256 + ->attachViewer($this->getActor()) 256 257 ->setHandles($handles) 257 258 ->setRenderingTarget('text') 258 259 ->getTitle();
+4
src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
··· 65 65 66 66 $xactions = $table->loadAllFromArray($data); 67 67 68 + foreach ($xactions as $xaction) { 69 + $xaction->attachViewer($this->getViewer()); 70 + } 71 + 68 72 if ($this->needComments) { 69 73 $comment_phids = array_filter(mpull($xactions, 'getCommentPHID')); 70 74
+11
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 28 28 private $handles; 29 29 private $renderingTarget = self::TARGET_HTML; 30 30 private $transactionGroup = array(); 31 + private $viewer = self::ATTACHABLE; 31 32 32 33 abstract public function getApplicationTransactionType(); 33 34 ··· 118 119 119 120 public function getRenderingTarget() { 120 121 return $this->renderingTarget; 122 + } 123 + 124 + public function attachViewer(PhabricatorUser $viewer) { 125 + $this->viewer = $viewer; 126 + return $this; 127 + } 128 + 129 + public function getViewer() { 130 + return $this->assertAttached($this->viewer); 121 131 } 122 132 123 133 public function getRequiredHandlePHIDs() { ··· 363 373 PhabricatorCustomField::ROLE_APPLICATIONTRANSACTIONS, 364 374 $key); 365 375 if ($field) { 376 + $field->setViewer($this->getViewer()); 366 377 return $field->getApplicationTransactionTitle($this); 367 378 } else { 368 379 return pht(