1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +01:00

Fix task + commit associating

Summary: we weren't actually removing any edges. now we do.

Test Plan: had a commit associated with task x; removed association. had a commit associated with task x; removed association while adding a different one.

Reviewers: floatinglomas, epriestley

Reviewed By: epriestley

CC: aran, Koolvin

Maniphest Tasks: T1256

Differential Revision: https://secure.phabricator.com/D2509
This commit is contained in:
Bob Trahan 2012-05-20 08:53:48 -07:00
parent de1973b516
commit 3d5d8d0f11

View file

@ -68,10 +68,18 @@ final class PhabricatorSearchAttachController
case self::ACTION_EDGE:
$edge_type = $this->getEdgeType($object_type, $attach_type);
$old_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
$this->phid,
$edge_type);
$add_phids = $phids;
$rem_phids = array_diff($old_phids, $add_phids);
$editor = id(new PhabricatorEdgeEditor());
foreach ($phids as $phid) {
foreach ($add_phids as $phid) {
$editor->addEdge($this->phid, $edge_type, $phid);
}
foreach ($rem_phids as $phid) {
$editor->removeEdge($this->phid, $edge_type, $phid);
}
$editor->save();
return id(new AphrontReloadResponse())->setURI($handle->getURI());