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

Maniphest - upgrade merging to real transactions

Summary: see title. Ref T5875.

Test Plan: Merged one task into another task - verified transactions on both tasks. Merged two tasks into another task - verified transactions on all three tasks. Checked out my feed and saw MERGE_INTO stories and MERGE_FROM stories.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5875

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

+84 -28
+12
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 26 26 $types[] = ManiphestTransaction::TYPE_CCS; 27 27 $types[] = ManiphestTransaction::TYPE_SUBPRIORITY; 28 28 $types[] = ManiphestTransaction::TYPE_PROJECT_COLUMN; 29 + $types[] = ManiphestTransaction::TYPE_MERGED_INTO; 30 + $types[] = ManiphestTransaction::TYPE_MERGED_FROM; 29 31 $types[] = ManiphestTransaction::TYPE_UNBLOCK; 30 32 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; 31 33 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; ··· 67 69 return $xaction->getOldValue(); 68 70 case ManiphestTransaction::TYPE_SUBPRIORITY: 69 71 return $object->getSubpriority(); 72 + case ManiphestTransaction::TYPE_MERGED_INTO: 73 + case ManiphestTransaction::TYPE_MERGED_FROM: 74 + return null; 70 75 } 71 76 } 72 77 ··· 86 91 case ManiphestTransaction::TYPE_DESCRIPTION: 87 92 case ManiphestTransaction::TYPE_SUBPRIORITY: 88 93 case ManiphestTransaction::TYPE_PROJECT_COLUMN: 94 + case ManiphestTransaction::TYPE_MERGED_INTO: 95 + case ManiphestTransaction::TYPE_MERGED_FROM: 89 96 case ManiphestTransaction::TYPE_UNBLOCK: 90 97 return $xaction->getNewValue(); 91 98 } ··· 160 167 return; 161 168 case ManiphestTransaction::TYPE_PROJECT_COLUMN: 162 169 // these do external (edge) updates 170 + return; 171 + case ManiphestTransaction::TYPE_MERGED_INTO: 172 + $object->setStatus(ManiphestTaskStatus::getDuplicateStatus()); 173 + return; 174 + case ManiphestTransaction::TYPE_MERGED_FROM: 163 175 return; 164 176 } 165 177 }
+48 -2
src/applications/maniphest/storage/ManiphestTransaction.php
··· 13 13 const TYPE_EDGE = 'edge'; 14 14 const TYPE_SUBPRIORITY = 'subpriority'; 15 15 const TYPE_PROJECT_COLUMN = 'projectcolumn'; 16 + const TYPE_MERGED_INTO = 'mergedinto'; 17 + const TYPE_MERGED_FROM = 'mergedfrom'; 16 18 17 19 const TYPE_UNBLOCK = 'unblock'; 18 20 ··· 95 97 case self::TYPE_PROJECT_COLUMN: 96 98 $phids[] = $new['projectPHID']; 97 99 $phids[] = head($new['columnPHIDs']); 100 + break; 101 + case self::TYPE_MERGED_INTO: 102 + $phids[] = $new; 103 + break; 104 + case self::TYPE_MERGED_FROM: 105 + $phids = array_merge($phids, $new); 98 106 break; 99 107 case self::TYPE_EDGE: 100 108 $phids = array_mergev( ··· 290 298 return pht('Blocker'); 291 299 } 292 300 301 + case self::TYPE_MERGED_INTO: 302 + case self::TYPE_MERGED_FROM: 303 + return pht('Merged'); 304 + 293 305 } 294 306 295 307 return parent::getActionName(); ··· 334 346 case self::TYPE_PROJECT_COLUMN: 335 347 return 'fa-columns'; 336 348 349 + case self::TYPE_MERGED_INTO: 350 + case self::TYPE_MERGED_FROM: 351 + return 'fa-compress'; 352 + 337 353 case self::TYPE_PRIORITY: 338 354 if ($old == ManiphestTaskPriority::getDefaultPriority()) { 339 355 return 'fa-arrow-right'; ··· 571 587 $this->renderHandleLink($author_phid), 572 588 $this->renderHandleLink($column_phid), 573 589 $this->renderHandleLink($project_phid)); 574 - break; 590 + break; 591 + 592 + case self::TYPE_MERGED_INTO: 593 + return pht( 594 + '%s merged this task into %s.', 595 + $this->renderHandleLink($author_phid), 596 + $this->renderHandleLink($new)); 597 + break; 598 + 599 + case self::TYPE_MERGED_FROM: 600 + return pht( 601 + '%s merged %d task(s): %s.', 602 + $this->renderHandleLink($author_phid), 603 + count($new), 604 + $this->renderHandleList($new)); 605 + break; 575 606 576 607 577 608 } ··· 815 846 $this->renderHandleLink($object_phid), 816 847 $this->renderHandleLink($column_phid), 817 848 $this->renderHandleLink($project_phid)); 818 - break; 849 + 850 + case self::TYPE_MERGED_INTO: 851 + return pht( 852 + '%s merged task %s into %s.', 853 + $this->renderHandleLink($author_phid), 854 + $this->renderHandleLink($object_phid), 855 + $this->renderHandleLink($new)); 856 + 857 + case self::TYPE_MERGED_FROM: 858 + return pht( 859 + '%s merged %d task(s) %s into %s.', 860 + $this->renderHandleLink($author_phid), 861 + count($new), 862 + $this->renderHandleList($new), 863 + $this->renderHandleLink($object_phid)); 864 + 819 865 } 820 866 821 867 return parent::getTitleForFeed($story);
+10 -26
src/applications/search/controller/PhabricatorSearchAttachController.php
··· 154 154 ->setContinueOnNoEffect(true) 155 155 ->setContinueOnMissingFields(true); 156 156 157 - $task_names = array(); 158 - 159 - $merge_into_name = 'T'.$task->getID(); 160 - 161 157 $cc_vector = array(); 162 158 $cc_vector[] = $task->getCCPHIDs(); 163 159 foreach ($targets as $target) { ··· 166 162 $target->getAuthorPHID(), 167 163 $target->getOwnerPHID()); 168 164 169 - $close_task = id(new ManiphestTransaction()) 170 - ->setTransactionType(ManiphestTransaction::TYPE_STATUS) 171 - ->setNewValue(ManiphestTaskStatus::getDuplicateStatus()); 172 - 173 - $merge_comment = id(new ManiphestTransaction()) 174 - ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) 175 - ->attachComment( 176 - id(new ManiphestTransactionComment()) 177 - ->setContent("\xE2\x9C\x98 Merged into {$merge_into_name}.")); 165 + $merged_into_txn = id(new ManiphestTransaction()) 166 + ->setTransactionType(ManiphestTransaction::TYPE_MERGED_INTO) 167 + ->setNewValue($task->getPHID()); 178 168 179 169 $editor->applyTransactions( 180 170 $target, 181 - array( 182 - $close_task, 183 - $merge_comment, 184 - )); 171 + array($merged_into_txn)); 185 172 186 - $task_names[] = 'T'.$target->getID(); 187 173 } 188 174 $all_ccs = array_mergev($cc_vector); 189 175 $all_ccs = array_filter($all_ccs); 190 176 $all_ccs = array_unique($all_ccs); 191 177 192 - $task_names = implode(', ', $task_names); 193 - 194 178 $add_ccs = id(new ManiphestTransaction()) 195 179 ->setTransactionType(ManiphestTransaction::TYPE_CCS) 196 180 ->setNewValue($all_ccs); 197 181 198 - $merged_comment = id(new ManiphestTransaction()) 199 - ->setTransactionType(PhabricatorTransactions::TYPE_COMMENT) 200 - ->attachComment( 201 - id(new ManiphestTransactionComment()) 202 - ->setContent("\xE2\x97\x80 Merged tasks: {$task_names}.")); 182 + $merged_from_txn = id(new ManiphestTransaction()) 183 + ->setTransactionType(ManiphestTransaction::TYPE_MERGED_FROM) 184 + ->setNewValue(mpull($targets, 'getPHID')); 203 185 204 - $editor->applyTransactions($task, array($add_ccs, $merged_comment)); 186 + $editor->applyTransactions( 187 + $task, 188 + array($add_ccs, $merged_from_txn)); 205 189 206 190 return $response; 207 191 }
+14
src/infrastructure/internationalization/translation/PhabricatorBaseEnglishTranslation.php
··· 341 341 ), 342 342 ), 343 343 344 + '%s merged %d task(s): %s.' => array( 345 + array( 346 + '%s merged a task: %3$s.', 347 + '%s merged tasks: %3$s.', 348 + ), 349 + ), 350 + 351 + '%s merged %d task(s) %s into %s.' => array( 352 + array( 353 + '%s merged %3$s into %4$s.', 354 + '%s merged tasks %3$s into %4$s.', 355 + ), 356 + ), 357 + 344 358 '%s edited voting user(s), added %d: %s; removed %d: %s.' => 345 359 '%s edited voting users, added: %3$s; removed: %5$s', 346 360