mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-24 20:49:06 +01:00
(stable) Fix an issue with "Auditors:" where an edge edit was used as a PHID list
Summary: See <https://discourse.phabricator-community.org/t/runtimeexception-during-import-of-commit/3801>. When importing commits with "Auditors:", a raw transaction new value (with an edge edit map using a "+" key) may be passed as an unmentionable PHID list. Instead, pass an actual PHID list. Test Plan: - Pushed a commit with "Auditors: duck". - Ran daemons. - Before patch: umentionable PHID exception. - After patch: clean commit import. - Verified "duck" was added as an auditor. Differential Revision: https://secure.phabricator.com/D21181
This commit is contained in:
parent
a338b1f433
commit
055d8b2728
1 changed files with 14 additions and 11 deletions
|
@ -232,14 +232,22 @@ final class PhabricatorAuditEditor
|
||||||
PhabricatorLiskDAO $object,
|
PhabricatorLiskDAO $object,
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
|
|
||||||
|
$auditors_type = DiffusionCommitAuditorsTransaction::TRANSACTIONTYPE;
|
||||||
|
|
||||||
$xactions = parent::expandTransaction($object, $xaction);
|
$xactions = parent::expandTransaction($object, $xaction);
|
||||||
|
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case PhabricatorAuditTransaction::TYPE_COMMIT:
|
case PhabricatorAuditTransaction::TYPE_COMMIT:
|
||||||
$request = $this->createAuditRequestTransactionFromCommitMessage(
|
$phids = $this->getAuditRequestTransactionPHIDsFromCommitMessage(
|
||||||
$object);
|
$object);
|
||||||
if ($request) {
|
if ($phids) {
|
||||||
$xactions[] = $request;
|
$xactions[] = $object->getApplicationTransactionTemplate()
|
||||||
$this->addUnmentionablePHIDs($request->getNewValue());
|
->setTransactionType($auditors_type)
|
||||||
|
->setNewValue(
|
||||||
|
array(
|
||||||
|
'+' => array_fuse($phids),
|
||||||
|
));
|
||||||
|
$this->addUnmentionablePHIDs($phids);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -268,7 +276,7 @@ final class PhabricatorAuditEditor
|
||||||
return $xactions;
|
return $xactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createAuditRequestTransactionFromCommitMessage(
|
private function getAuditRequestTransactionPHIDsFromCommitMessage(
|
||||||
PhabricatorRepositoryCommit $commit) {
|
PhabricatorRepositoryCommit $commit) {
|
||||||
|
|
||||||
$actor = $this->getActor();
|
$actor = $this->getActor();
|
||||||
|
@ -297,12 +305,7 @@ final class PhabricatorAuditEditor
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $commit->getApplicationTransactionTemplate()
|
return $phids;
|
||||||
->setTransactionType(DiffusionCommitAuditorsTransaction::TRANSACTIONTYPE)
|
|
||||||
->setNewValue(
|
|
||||||
array(
|
|
||||||
'+' => array_fuse($phids),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function sortTransactions(array $xactions) {
|
protected function sortTransactions(array $xactions) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue