1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Give audits a clickable commit title, even if they are importing or messageless

Summary:
Fixes T3854. Subversion allows commits with no message, and in other cases we might not have imported the message yet. In these cases, we may not render any text inside the link.

When we hit these cases, render appropriate replacement text.

Test Plan: {F156229}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T3854

Differential Revision: https://secure.phabricator.com/D9169
This commit is contained in:
epriestley 2014-05-17 15:25:31 -07:00
parent 1efb7e9497
commit 28c198d902

View file

@ -66,15 +66,27 @@ final class PhabricatorAuditListView extends AphrontView {
private function getCommitDescription($phid) {
if ($this->commits === null) {
return null;
return pht('(Unknown Commit)');
}
$commit = idx($this->commits, $phid);
if (!$commit) {
return null;
return pht('(Unknown Commit)');
}
return $commit->getCommitData()->getSummary();
$summary = $commit->getCommitData()->getSummary();
if (strlen($summary)) {
return $summary;
}
// No summary, so either this is still impoting or just has an empty
// commit message.
if (!$commit->isImported()) {
return pht('(Importing Commit...)');
} else {
return pht('(Untitled Commit)');
}
}
public function render() {
@ -134,14 +146,14 @@ final class PhabricatorAuditListView extends AphrontView {
$author_name = $commit->getCommitData()->getAuthorName();
$item = id(new PHUIObjectItemView())
->setObjectName($commit_name)
->setHeader($commit_desc)
->setHref($commit_link)
->setBarColor($status_color)
->addAttribute($status_text)
->addAttribute($reasons)
->addIcon('none', $committed)
->addByline(pht('Author: %s', $author_name));
->setObjectName($commit_name)
->setHeader($commit_desc)
->setHref($commit_link)
->setBarColor($status_color)
->addAttribute($status_text)
->addAttribute($reasons)
->addIcon('none', $committed)
->addByline(pht('Author: %s', $author_name));
if (!empty($auditors)) {
$item->addAttribute(pht('Auditors: %s', $auditors));