Commit 4904d771 authored by epriestley's avatar epriestley
Browse files

When publishing a commit, copy "Related Tasks" from the associated revision (if one exists)

Fixes T13463. Currently, if you use the web UI to set "Related Tasks" for a revision, the resulting commit does not link to the tasks.

If you use "Ref ..." in the message instead, the resulting commit does link to the tasks.

Broadly, this should all be cleaner (see T3577) but we can step toward better behavior by just copying these edges when commits are published.

Test Plan:
  - Created a revision.
  - Used the web UI to edit "Related Tasks".
  - Landed the revision.
  - Saw the commit link to the tasks as though I'd used "Ref ..." in the message.

Maniphest Tasks: T13463

Differential Revision:
parent 530145ba
......@@ -405,6 +405,31 @@ final class PhabricatorAuditEditor
$phid_map[] = $reverted_phids;
// See T13463. Copy "related task" edges from the associated revision, if
// one exists.
$revision = DiffusionCommitRevisionQuery::loadRevisionForCommit(
if ($revision) {
$task_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
$task_phids = array_fuse($task_phids);
if ($task_phids) {
$related_edge = DiffusionCommitHasTaskEdgeType::EDGECONST;
$result[] = id(new PhabricatorAuditTransaction())
->setMetadataValue('edge:type', $related_edge)
->setNewValue(array('+' => $task_phids));
// Mark these objects as unmentionable, since the explicit relationship
// is stronger and any mentions are redundant.
$phid_map[] = $task_phids;
$phid_map = array_mergev($phid_map);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment