mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 15:22:41 +01:00
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:
parent
3231df7625
commit
338851ac54
2 changed files with 44 additions and 4 deletions
|
@ -493,10 +493,42 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
|||
=> pht('Depends On'),
|
||||
PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV
|
||||
=> 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) {
|
||||
if ($edges[$edge_type]) {
|
||||
$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();
|
||||
$file_infos = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE);
|
||||
if ($file_infos) {
|
||||
|
|
|
@ -166,8 +166,10 @@ final class PhabricatorObjectHandle {
|
|||
}
|
||||
|
||||
|
||||
public function renderLink() {
|
||||
$name = $this->getLinkName();
|
||||
public function renderLink($name = null) {
|
||||
if ($name === null) {
|
||||
$name = $this->getLinkName();
|
||||
}
|
||||
$class = null;
|
||||
$title = null;
|
||||
|
||||
|
|
Loading…
Reference in a new issue