Merge attached revisions and commits in task detail
Summary:
With freetext fields, most tasks would have attached revisions when they have attached commits.
See T1048 for example.
Merge these two fields together.
Test Plan:
Displayed task with commit and unrelated revision.
Displayed task with commit and related revision:
{F39394,size=full}
Reviewers: epriestley
Reviewed By: epriestley
CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D5601
This commit is contained in:
@@ -493,10 +493,42 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
|||||||
=> pht('Depends On'),
|
=> pht('Depends On'),
|
||||||
PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV
|
PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV
|
||||||
=> pht('Differential Revisions'),
|
=> pht('Differential Revisions'),
|
||||||
PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT
|
|
||||||
=> pht('Commits'),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$revisions_commits = array();
|
||||||
|
$handles = $this->getLoadedHandles();
|
||||||
|
|
||||||
|
$commit_phids = array_keys(
|
||||||
|
$edges[PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT]);
|
||||||
|
if ($commit_phids) {
|
||||||
|
$commits = id(new PhabricatorRepositoryCommit())
|
||||||
|
->putInSet(new LiskDAOSet())
|
||||||
|
->loadAllWhere('phid IN (%Ls)', $commit_phids);
|
||||||
|
|
||||||
|
foreach ($commits as $commit) {
|
||||||
|
$phid = $commit->getPHID();
|
||||||
|
$revisions_commits[$phid] = $handles[$phid]->renderLink();
|
||||||
|
|
||||||
|
$data = $commit->loadOneRelative(
|
||||||
|
new PhabricatorRepositoryCommitData(),
|
||||||
|
'commitID');
|
||||||
|
|
||||||
|
$revision_phid = ($data
|
||||||
|
? $data->getCommitDetail('differential.revisionPHID')
|
||||||
|
: null);
|
||||||
|
|
||||||
|
$revision_handle = idx($handles, $revision_phid);
|
||||||
|
if ($revision_handle) {
|
||||||
|
$has_drev = PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV;
|
||||||
|
unset($edges[$has_drev][$revision_phid]);
|
||||||
|
$revisions_commits[$phid] = hsprintf(
|
||||||
|
'%s / %s',
|
||||||
|
$revision_handle->renderLink($revision_handle->getName()),
|
||||||
|
$revisions_commits[$phid]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($edge_types as $edge_type => $edge_name) {
|
foreach ($edge_types as $edge_type => $edge_name) {
|
||||||
if ($edges[$edge_type]) {
|
if ($edges[$edge_type]) {
|
||||||
$view->addProperty(
|
$view->addProperty(
|
||||||
@@ -505,6 +537,12 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($revisions_commits) {
|
||||||
|
$view->addProperty(
|
||||||
|
pht('Commits'),
|
||||||
|
phutil_implode_html(phutil_tag('br'), $revisions_commits));
|
||||||
|
}
|
||||||
|
|
||||||
$attached = $task->getAttached();
|
$attached = $task->getAttached();
|
||||||
$file_infos = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE);
|
$file_infos = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE);
|
||||||
if ($file_infos) {
|
if ($file_infos) {
|
||||||
|
|||||||
@@ -166,8 +166,10 @@ final class PhabricatorObjectHandle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function renderLink() {
|
public function renderLink($name = null) {
|
||||||
$name = $this->getLinkName();
|
if ($name === null) {
|
||||||
|
$name = $this->getLinkName();
|
||||||
|
}
|
||||||
$class = null;
|
$class = null;
|
||||||
$title = null;
|
$title = null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user