1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 23:02:42 +01:00

Use the same transaction group ID for transactions applied indirectly by a sub-editor

Summary:
Ref T13283. Currently, each Editor sets its own group ID, so if you create a revision and then Herald does some stuff, the two groups of transactions get different group IDs.

This means the test console is slightly misleading (it will only pick up the Herald transactions). It's going to be misleading anyway (Herald obviously can't evaluate Herald transactions) but this is at least a little closer to reality and stops Herald actions from masking non-Herald actions.

Test Plan:
  - Created a revision. Herald applied one transaction.
  - Used the test console.
  - Before: The test console only picked up the single most recent Herald transaction.
  - After: The test console picked up the whole transaction group.

{F6464059}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13283

Differential Revision: https://secure.phabricator.com/D20546
This commit is contained in:
epriestley 2019-05-22 14:38:20 -07:00
parent f6af1c4374
commit 31e623afcc

View file

@ -54,6 +54,7 @@ abstract class PhabricatorApplicationTransactionEditor
private $heraldTranscript; private $heraldTranscript;
private $subscribers; private $subscribers;
private $unmentionablePHIDMap = array(); private $unmentionablePHIDMap = array();
private $transactionGroupID;
private $applicationEmail; private $applicationEmail;
private $isPreview; private $isPreview;
@ -975,6 +976,14 @@ abstract class PhabricatorApplicationTransactionEditor
return $this->cancelURI; return $this->cancelURI;
} }
protected function getTransactionGroupID() {
if ($this->transactionGroupID === null) {
$this->transactionGroupID = Filesystem::readRandomCharacters(32);
}
return $this->transactionGroupID;
}
final public function applyTransactions( final public function applyTransactions(
PhabricatorLiskDAO $object, PhabricatorLiskDAO $object,
array $xactions) { array $xactions) {
@ -1164,7 +1173,7 @@ abstract class PhabricatorApplicationTransactionEditor
throw $ex; throw $ex;
} }
$group_id = Filesystem::readRandomCharacters(32); $group_id = $this->getTransactionGroupID();
foreach ($xactions as $xaction) { foreach ($xactions as $xaction) {
if ($was_locked) { if ($was_locked) {
@ -4666,6 +4675,7 @@ abstract class PhabricatorApplicationTransactionEditor
} }
$editor->mustEncrypt = $this->mustEncrypt; $editor->mustEncrypt = $this->mustEncrypt;
$editor->transactionGroupID = $this->getTransactionGroupID();
return $editor; return $editor;
} }