Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/view/DiffusionCommitGraphView.php
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | if ($show_revisions) { | ||||
$revision_map = $this->getRevisionMap(); | $revision_map = $this->getRevisionMap(); | ||||
foreach ($revision_map as $revisions) { | foreach ($revision_map as $revisions) { | ||||
foreach ($revisions as $revision) { | foreach ($revisions as $revision) { | ||||
$phids[] = $revision->getPHID(); | $phids[] = $revision->getPHID(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if ($show_auditors) { | |||||
$commits = $this->getCommitMap(); | $commits = $this->getCommitMap(); | ||||
foreach ($commits as $commit) { | |||||
$author_phid = $commit->getAuthorDisplayPHID(); | |||||
if ($author_phid !== null) { | |||||
$phids[] = $author_phid; | |||||
} | |||||
} | |||||
if ($show_auditors) { | |||||
foreach ($commits as $commit) { | foreach ($commits as $commit) { | ||||
$audits = $commit->getAudits(); | $audits = $commit->getAudits(); | ||||
foreach ($audits as $auditor) { | foreach ($audits as $auditor) { | ||||
$phids[] = $auditor->getAuditorPHID(); | $phids[] = $auditor->getAuditorPHID(); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | foreach ($items as $hash => $item) { | ||||
->setValue($author_view); | ->setValue($author_view); | ||||
} | } | ||||
} | } | ||||
if ($show_revisions) { | if ($show_revisions) { | ||||
if ($commit) { | if ($commit) { | ||||
$revisions = $this->getRevisions($commit); | $revisions = $this->getRevisions($commit); | ||||
if ($revisions) { | if ($revisions) { | ||||
$revision = head($revisions); | $list_view = $handles->newSublist(mpull($revisions, 'getPHID')) | ||||
$handle = $handles[$revision->getPHID()]; | ->newListView(); | ||||
$property_list->newItem() | $property_list->newItem() | ||||
->setName(pht('Revision')) | ->setName(pht('Revisions')) | ||||
->setValue($handle->renderLink()); | ->setValue($list_view); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
$views[$hash] = $item_view; | $views[$hash] = $item_view; | ||||
} | } | ||||
return $views; | return $views; | ||||
▲ Show 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | final class DiffusionCommitGraphView | ||||
private function getCommitAuthorView($commit) { | private function getCommitAuthorView($commit) { | ||||
if (!$commit) { | if (!$commit) { | ||||
return null; | return null; | ||||
} | } | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$author_phid = $commit->getAuthorDisplayPHID(); | |||||
if ($author_phid) { | |||||
return $viewer->loadHandles(array($author_phid)) | |||||
->newListView(); | |||||
} | |||||
return $commit->newCommitAuthorView($viewer); | return $commit->newCommitAuthorView($viewer); | ||||
} | } | ||||
private function getCommit($hash) { | private function getCommit($hash) { | ||||
$commit_map = $this->getCommitMap(); | $commit_map = $this->getCommitMap(); | ||||
return idx($commit_map, $hash); | return idx($commit_map, $hash); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | final class DiffusionCommitGraphView | ||||
private function addAuditAction(PHUIObjectItemView $item_view, $hash) { | private function addAuditAction(PHUIObjectItemView $item_view, $hash) { | ||||
$commit = $this->getCommit($hash); | $commit = $this->getCommit($hash); | ||||
if ($commit) { | if ($commit) { | ||||
$status = $commit->getAuditStatusObject(); | $status = $commit->getAuditStatusObject(); | ||||
$text = $status->getName(); | $text = $status->getName(); | ||||
$color = $status->getColor(); | |||||
$icon = $status->getIcon(); | $icon = $status->getIcon(); | ||||
$is_disabled = $status->isNoAudit(); | |||||
if ($is_disabled) { | |||||
$uri = null; | |||||
$color = 'grey'; | |||||
} else { | |||||
$color = $status->getColor(); | |||||
$uri = $commit->getURI(); | $uri = $commit->getURI(); | ||||
} | |||||
$is_disabled = false; | |||||
} else { | } else { | ||||
$text = pht('No Audit'); | $text = pht('No Audit'); | ||||
$color = 'grey'; | $color = 'grey'; | ||||
$icon = 'fa-times'; | $icon = 'fa-times'; | ||||
$uri = null; | $uri = null; | ||||
$is_disabled = true; | $is_disabled = true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | private function newAuditorList( | ||||
$auditors = $commit->getAudits(); | $auditors = $commit->getAudits(); | ||||
if (!$auditors) { | if (!$auditors) { | ||||
return phutil_tag('em', array(), pht('None')); | return phutil_tag('em', array(), pht('None')); | ||||
} | } | ||||
$auditor_phids = mpull($auditors, 'getAuditorPHID'); | $auditor_phids = mpull($auditors, 'getAuditorPHID'); | ||||
$auditor_list = $handles->newSublist($auditor_phids) | $auditor_list = $handles->newSublist($auditor_phids) | ||||
->renderList() | ->newListView(); | ||||
->setAsInline(true); | |||||
return $auditor_list; | return $auditor_list; | ||||
} | } | ||||
} | } |