1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 12:41:19 +01:00

Explicitly degrade edge editing for commit/task edges until T4896

Summary:
Commits don't support `PhabricatorApplicationTransactionInterface` yet, so the "Edit Maniphest Tasks" dialog from the commit UI currently bombs.

Hard-code it to do the correct writes in a low-level way. After T4896 we can remove this and do `ApplicationTransaction` stuff.

Test Plan: Used the "Edit Maniphest Tasks" UI from Diffusion.

Reviewers: joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D9975
This commit is contained in:
epriestley 2014-07-17 18:37:09 -07:00
parent 48f6189f32
commit 17afcdcf95

View file

@ -57,6 +57,39 @@ final class PhabricatorSearchAttachController
$phids = array_values($phids); $phids = array_values($phids);
if ($edge_type) { if ($edge_type) {
if ($object instanceof PhabricatorRepositoryCommit) {
// TODO: Remove this entire branch of special cased grossness
// after T4896.
$old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
$this->phid,
$edge_type);
$add_phids = $phids;
$rem_phids = array_diff($old_phids, $add_phids);
// Doing this correctly (in a way that writes edge transactions) would
// be a huge mess and we don't get the commit half of the transaction
// anyway until T4896, so just write the edges themselves and skip
// the transactions for now.
$editor = new PhabricatorEdgeEditor();
foreach ($add_phids as $phid) {
$editor->addEdge(
$object->getPHID(),
DiffusionCommitHasTaskEdgeType::EDGECONST,
$phid);
}
foreach ($rem_phids as $phid) {
$editor->removeEdge(
$object->getPHID(),
DiffusionCommitHasTaskEdgeType::EDGECONST,
$phid);
}
$editor->save();
} else {
if (!$object instanceof PhabricatorApplicationTransactionInterface) { if (!$object instanceof PhabricatorApplicationTransactionInterface) {
throw new Exception( throw new Exception(
pht( pht(
@ -83,6 +116,7 @@ final class PhabricatorSearchAttachController
$txn_editor->applyTransactions( $txn_editor->applyTransactions(
$object->getApplicationTransactionObject(), $object->getApplicationTransactionObject(),
array($txn_template)); array($txn_template));
}
return id(new AphrontReloadResponse())->setURI($handle->getURI()); return id(new AphrontReloadResponse())->setURI($handle->getURI());
} else { } else {