1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

Fix an issue with destruction of Revision and Diff objects with viewstates

Summary:
See <https://discourse.phabricator-community.org/t/domainexception-when-trying-to-remove-an-differentialrevision/4105>.

These queries aren't actually constructed properly, and destroying a revision or diff with viewstates currently fails.

Test Plan: Used `bin/remove destroy Dxxx` to destroy a revision with viewstates (this also destroys the associated diffs).

Differential Revision: https://secure.phabricator.com/D21421
This commit is contained in:
epriestley 2020-07-22 11:54:06 -07:00
parent 0ed5569e9f
commit 8f9ba48528
2 changed files with 4 additions and 2 deletions

View file

@ -737,9 +737,10 @@ final class DifferentialDiff
$prop->delete(); $prop->delete();
} }
$viewstates = id(new DifferentialViewStateQuery()) $viewstate_query = id(new DifferentialViewStateQuery())
->setViewer($viewer) ->setViewer($viewer)
->withObjectPHIDs(array($this->getPHID())); ->withObjectPHIDs(array($this->getPHID()));
$viewstates = new PhabricatorQueryIterator($viewstate_query);
foreach ($viewstates as $viewstate) { foreach ($viewstates as $viewstate) {
$viewstate->delete(); $viewstate->delete();
} }

View file

@ -1033,9 +1033,10 @@ final class DifferentialRevision extends DifferentialDAO
$dummy_path->getTableName(), $dummy_path->getTableName(),
$this->getID()); $this->getID());
$viewstates = id(new DifferentialViewStateQuery()) $viewstate_query = id(new DifferentialViewStateQuery())
->setViewer($viewer) ->setViewer($viewer)
->withObjectPHIDs(array($this->getPHID())); ->withObjectPHIDs(array($this->getPHID()));
$viewstates = new PhabricatorQueryIterator($viewstate_query);
foreach ($viewstates as $viewstate) { foreach ($viewstates as $viewstate) {
$viewstate->delete(); $viewstate->delete();
} }