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

Render new more-general move transactions in a human-readable way

Summary: Ref T6027. This adds human-readable rendering for the new `TYPE_COLUMNS` core transactions.

Test Plan: {F1207784}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T6027

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

+107 -1
+107 -1
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 256 256 $phids[] = ipull($old, 'dst'); 257 257 $phids[] = ipull($new, 'dst'); 258 258 break; 259 + case PhabricatorTransactions::TYPE_COLUMNS: 260 + foreach ($new as $move) { 261 + $phids[] = array( 262 + $move['columnPHID'], 263 + $move['boardPHID'], 264 + ); 265 + $phids[] = $move['fromColumnPHIDs']; 266 + } 267 + break; 259 268 case PhabricatorTransactions::TYPE_EDIT_POLICY: 260 269 case PhabricatorTransactions::TYPE_VIEW_POLICY: 261 270 case PhabricatorTransactions::TYPE_JOIN_POLICY: ··· 407 416 return 'fa-trophy'; 408 417 case PhabricatorTransactions::TYPE_SPACE: 409 418 return 'fa-th-large'; 419 + case PhabricatorTransactions::TYPE_COLUMNS: 420 + return 'fa-columns'; 410 421 } 411 422 412 423 return 'fa-pencil'; ··· 493 504 case PhabricatorTransactions::TYPE_EDIT_POLICY: 494 505 case PhabricatorTransactions::TYPE_JOIN_POLICY: 495 506 case PhabricatorTransactions::TYPE_SPACE: 507 + case PhabricatorTransactions::TYPE_COLUMNS: 496 508 break; 497 509 default: 498 510 $old = $this->getOldValue(); ··· 501 513 return true; 502 514 } 503 515 504 - if (!strlen($old)) { 516 + if (!is_array($old) && !strlen($old)) { 505 517 return true; 506 518 } 519 + 507 520 break; 508 521 } 509 522 } ··· 549 562 if ($field) { 550 563 return $field->shouldHideInApplicationTransactions($this); 551 564 } 565 + case PhabricatorTransactions::TYPE_COLUMNS: 566 + return !$this->getInterestingMoves($this->getNewValue()); 552 567 case PhabricatorTransactions::TYPE_EDGE: 553 568 $edge_type = $this->getMetadataValue('edge:type'); 554 569 switch ($edge_type) { ··· 930 945 } 931 946 break; 932 947 948 + case PhabricatorTransactions::TYPE_COLUMNS: 949 + $moves = $this->getInterestingMoves($new); 950 + if (count($moves) == 1) { 951 + $move = head($moves); 952 + $from_columns = $move['fromColumnPHIDs']; 953 + $to_column = $move['columnPHID']; 954 + $board_phid = $move['boardPHID']; 955 + if (count($from_columns) == 1) { 956 + return pht( 957 + '%s moved this task from %s to %s on the %s board.', 958 + $this->renderHandleLink($author_phid), 959 + $this->renderHandleLink(head($from_columns)), 960 + $this->renderHandleLink($to_column), 961 + $this->renderHandleLink($board_phid)); 962 + } else { 963 + return pht( 964 + '%s moved this task to %s on the %s board.', 965 + $this->renderHandleLink($author_phid), 966 + $this->renderHandleLink($to_column), 967 + $this->renderHandleLink($board_phid)); 968 + } 969 + } else { 970 + $fragments = array(); 971 + foreach ($moves as $move) { 972 + $fragments[] = pht( 973 + '%s (%s)', 974 + $this->renderHandleLink($board_phid), 975 + $this->renderHandleLink($to_column)); 976 + } 977 + 978 + return pht( 979 + '%s moved this task on %s board(s): %s.', 980 + $this->renderHandleLink($author_phid), 981 + phutil_count($moves), 982 + phutil_implode_html(', ', $fragments)); 983 + } 984 + break; 985 + 933 986 default: 934 987 return pht( 935 988 '%s edited this %s.', ··· 1057 1110 default: 1058 1111 return null; 1059 1112 } 1113 + 1114 + case PhabricatorTransactions::TYPE_COLUMNS: 1115 + $moves = $this->getInterestingMoves($new); 1116 + if (count($moves) == 1) { 1117 + $move = head($moves); 1118 + $from_columns = $move['fromColumnPHIDs']; 1119 + $to_column = $move['columnPHID']; 1120 + $board_phid = $move['boardPHID']; 1121 + if (count($from_columns) == 1) { 1122 + return pht( 1123 + '%s moved %s from %s to %s on the %s board.', 1124 + $this->renderHandleLink($author_phid), 1125 + $this->renderHandleLink($object_phid), 1126 + $this->renderHandleLink(head($from_columns)), 1127 + $this->renderHandleLink($to_column), 1128 + $this->renderHandleLink($board_phid)); 1129 + } else { 1130 + return pht( 1131 + '%s moved %s to %s on the %s board.', 1132 + $this->renderHandleLink($author_phid), 1133 + $this->renderHandleLink($object_phid), 1134 + $this->renderHandleLink($to_column), 1135 + $this->renderHandleLink($board_phid)); 1136 + } 1137 + } else { 1138 + $fragments = array(); 1139 + foreach ($moves as $move) { 1140 + $fragments[] = pht( 1141 + '%s (%s)', 1142 + $this->renderHandleLink($board_phid), 1143 + $this->renderHandleLink($to_column)); 1144 + } 1145 + 1146 + return pht( 1147 + '%s moved %s on %s board(s): %s.', 1148 + $this->renderHandleLink($author_phid), 1149 + $this->renderHandleLink($object_phid), 1150 + phutil_count($moves), 1151 + phutil_implode_html(', ', $fragments)); 1152 + } 1153 + break; 1060 1154 1061 1155 } 1062 1156 ··· 1362 1456 } 1363 1457 1364 1458 return true; 1459 + } 1460 + 1461 + private function getInterestingMoves(array $moves) { 1462 + // Remove moves which only shift the position of a task within a column. 1463 + foreach ($moves as $key => $move) { 1464 + $from_phids = array_fuse($move['fromColumnPHIDs']); 1465 + if (isset($from_phids[$move['columnPHID']])) { 1466 + unset($moves[$key]); 1467 + } 1468 + } 1469 + 1470 + return $moves; 1365 1471 } 1366 1472 1367 1473