Allow Commits to be attached to Tasks using edges
Summary: Use Edges to attach Commits and Tasks. Note, no "edit attached commits" interface from tasks yet since the search backend needs a little work to list commits in a sensible way. Test Plan: Attached commits to tasks. Looked at commits, looked at tasks. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T904 Differential Revision: https://secure.phabricator.com/D2105
This commit is contained in:
@@ -270,7 +270,11 @@ final class DiffusionCommitController extends DiffusionController {
|
||||
assert_instances_of($parents, 'PhabricatorRepositoryCommit');
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$phids = array();
|
||||
$task_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$commit->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_COMMIT_HAS_TASK);
|
||||
|
||||
$phids = $task_phids;
|
||||
if ($data->getCommitDetail('authorPHID')) {
|
||||
$phids[] = $data->getCommitDetail('authorPHID');
|
||||
}
|
||||
@@ -333,6 +337,7 @@ final class DiffusionCommitController extends DiffusionController {
|
||||
$props['Parents'] = implode(' · ', $parent_links);
|
||||
}
|
||||
|
||||
|
||||
$request = $this->getDiffusionRequest();
|
||||
|
||||
$contains = DiffusionContainsQuery::newFromDiffusionRequest($request);
|
||||
@@ -345,6 +350,15 @@ final class DiffusionCommitController extends DiffusionController {
|
||||
$props['Branches'] = $branches;
|
||||
}
|
||||
|
||||
if ($task_phids) {
|
||||
$task_list = array();
|
||||
foreach ($task_phids as $phid) {
|
||||
$task_list[] = $handles[$phid]->renderLink();
|
||||
}
|
||||
$task_list = implode('<br />', $task_list);
|
||||
$props['Tasks'] = $task_list;
|
||||
}
|
||||
|
||||
return $props;
|
||||
}
|
||||
|
||||
@@ -634,18 +648,13 @@ final class DiffusionCommitController extends DiffusionController {
|
||||
require_celerity_resource('phabricator-object-selector-css');
|
||||
require_celerity_resource('javelin-behavior-phabricator-object-selector');
|
||||
|
||||
/*
|
||||
TODO: Implement this.
|
||||
|
||||
$action = new AphrontHeadsupActionView();
|
||||
$action->setName('Edit Maniphest Tasks');
|
||||
$action->setURI('/search/attach/'.$commit->getPHID().'/TASK/');
|
||||
$action->setURI('/search/attach/'.$commit->getPHID().'/TASK/edge/');
|
||||
$action->setWorkflow(true);
|
||||
$action->setClass('attach-maniphest');
|
||||
$actions[] = $action;
|
||||
|
||||
*/
|
||||
|
||||
if ($user->getIsAdmin()) {
|
||||
$action = new AphrontHeadsupActionView();
|
||||
$action->setName('MetaMTA Transcripts');
|
||||
|
||||
@@ -36,6 +36,8 @@ phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');
|
||||
phutil_require_module('phabricator', 'applications/repository/storage/repository');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/edges/constants/config');
|
||||
phutil_require_module('phabricator', 'infrastructure/edges/query/edge');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
|
||||
Reference in New Issue
Block a user