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

Merge multiple Auditors transactions from Herald

Summary:
Fixes T12302. Currently, we aren't merging multiple "AddAuditors" transactions correctly.

This can occur when Herald triggers multiple auditor rules.

Instead, merge them.

Test Plan:
- Wrote two different Herald rules that add auditors.
- Pushed a commit which triggered them.
- After the change, saw all the auditors get added correctly.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12302

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

+38
+25
src/applications/diffusion/xaction/DiffusionCommitAuditorsTransaction.php
··· 58 58 return ($old !== $new); 59 59 } 60 60 61 + public function mergeTransactions( 62 + $object, 63 + PhabricatorApplicationTransaction $u, 64 + PhabricatorApplicationTransaction $v) { 65 + 66 + $u_new = $u->getNewValue(); 67 + $v_new = $v->getNewValue(); 68 + 69 + $result = $v_new; 70 + foreach (array('-', '+') as $key) { 71 + $u_value = idx($u_new, $key, array()); 72 + $v_value = idx($v_new, $key, array()); 73 + 74 + $merged = $u_value + $v_value; 75 + 76 + if ($merged) { 77 + $result[$key] = $merged; 78 + } 79 + } 80 + 81 + $u->setNewValue($result); 82 + 83 + return $u; 84 + } 85 + 61 86 public function applyExternalEffects($object, $value) { 62 87 $src_phid = $object->getPHID(); 63 88
+6
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 1462 1462 1463 1463 $type = $u->getTransactionType(); 1464 1464 1465 + $xtype = $this->getModularTransactionType($type); 1466 + if ($xtype) { 1467 + $object = $this->object; 1468 + return $xtype->mergeTransactions($object, $u, $v); 1469 + } 1470 + 1465 1471 switch ($type) { 1466 1472 case PhabricatorTransactions::TYPE_SUBSCRIBERS: 1467 1473 return $this->mergePHIDOrEdgeTransactions($u, $v);
+7
src/applications/transactions/storage/PhabricatorModularTransactionType.php
··· 87 87 return array(); 88 88 } 89 89 90 + public function mergeTransactions( 91 + $object, 92 + PhabricatorApplicationTransaction $u, 93 + PhabricatorApplicationTransaction $v) { 94 + return null; 95 + } 96 + 90 97 final public function setStorage( 91 98 PhabricatorApplicationTransaction $xaction) { 92 99 $this->storage = $xaction;