mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-11 16:16:14 +01:00
54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
final class DiffusionHovercardEngineExtension
|
||
|
extends PhabricatorHovercardEngineExtension {
|
||
|
|
||
|
const EXTENSIONKEY = 'diffusion';
|
||
|
|
||
|
public function isExtensionEnabled() {
|
||
|
return PhabricatorApplication::isClassInstalled(
|
||
|
'PhabricatorDiffusionApplication');
|
||
|
}
|
||
|
|
||
|
public function getExtensionName() {
|
||
|
return pht('Diffusion Commits');
|
||
|
}
|
||
|
|
||
|
public function canRenderObjectHovercard($object) {
|
||
|
return ($object instanceof PhabricatorRepositoryCommit);
|
||
|
}
|
||
|
|
||
|
public function renderHovercard(
|
||
|
PhabricatorHovercardView $hovercard,
|
||
|
PhabricatorObjectHandle $handle,
|
||
|
$commit,
|
||
|
$data) {
|
||
|
|
||
|
$viewer = $this->getViewer();
|
||
|
|
||
|
$author_phid = $commit->getAuthorPHID();
|
||
|
if ($author_phid) {
|
||
|
$author = $viewer->loadHandle($author)->renderLink();
|
||
|
} else {
|
||
|
$commit_data = $commit->loadCommitData();
|
||
|
$author = phutil_tag('em', array(), $commit_data->getAuthorName());
|
||
|
}
|
||
|
|
||
|
$hovercard->setTitle($handle->getName());
|
||
|
$hovercard->setDetail($commit->getSummary());
|
||
|
|
||
|
$hovercard->addField(pht('Author'), $author);
|
||
|
$hovercard->addField(pht('Date'),
|
||
|
phabricator_date($commit->getEpoch(), $viewer));
|
||
|
|
||
|
if ($commit->getAuditStatus() !=
|
||
|
PhabricatorAuditCommitStatusConstants::NONE) {
|
||
|
|
||
|
$hovercard->addField(pht('Audit Status'),
|
||
|
PhabricatorAuditCommitStatusConstants::getStatusName(
|
||
|
$commit->getAuditStatus()));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|