mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Provide hovercards for generic edge stories, and include more message information in commit hovercards
Summary: Ref T13620. - Make generic edge stories render links with hovercards. Other story types (like subscriptions) already do this so I'm fairly certain this is just old code from before hovercards. - Include a longer commit message snippet in hovercards. Test Plan: {F8465645} Maniphest Tasks: T13620 Differential Revision: https://secure.phabricator.com/D21574
This commit is contained in:
parent
6bfa990254
commit
e9804bb7e5
3 changed files with 22 additions and 3 deletions
|
@ -48,7 +48,20 @@ final class DiffusionHovercardEngineExtension
|
|||
$handles = $viewer->loadHandles($phids);
|
||||
|
||||
$hovercard->setTitle($handle->getName());
|
||||
$hovercard->setDetail($commit->getSummary());
|
||||
|
||||
// See T13620. Use a longer slice of the message than the "summary" here,
|
||||
// since we have at least a few lines of room in the UI.
|
||||
$commit_message = $commit->getCommitMessageForDisplay();
|
||||
|
||||
$message_limit = 512;
|
||||
|
||||
$short_message = id(new PhutilUTF8StringTruncator())
|
||||
->setMaximumBytes($message_limit * 4)
|
||||
->setMaximumGlyphs($message_limit)
|
||||
->truncateString($commit_message);
|
||||
$short_message = phutil_escape_html_newlines($short_message);
|
||||
|
||||
$hovercard->setDetail($short_message);
|
||||
|
||||
$repository = $handles[$repository_phid]->renderLink();
|
||||
$hovercard->addField(pht('Repository'), $repository);
|
||||
|
@ -64,7 +77,7 @@ final class DiffusionHovercardEngineExtension
|
|||
}
|
||||
|
||||
$date = phabricator_date($commit->getEpoch(), $viewer);
|
||||
$hovercard->addField(pht('Date'), $date);
|
||||
$hovercard->addField(pht('Commit Date'), $date);
|
||||
|
||||
if (!$commit->isAuditStatusNoAudit()) {
|
||||
$status = $commit->getAuditStatusObject();
|
||||
|
|
|
@ -528,6 +528,12 @@ final class PhabricatorRepositoryCommit
|
|||
return $data->getCommitterString();
|
||||
}
|
||||
|
||||
public function getCommitMessageForDisplay() {
|
||||
$data = $this->getCommitData();
|
||||
$message = $data->getCommitMessage();
|
||||
return $message;
|
||||
}
|
||||
|
||||
public function newCommitRef(PhabricatorUser $viewer) {
|
||||
$repository = $this->getRepository();
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ abstract class PhabricatorApplicationTransaction
|
|||
|
||||
public function renderHandleLink($phid) {
|
||||
if ($this->renderingTarget == self::TARGET_HTML) {
|
||||
return $this->getHandle($phid)->renderLink();
|
||||
return $this->getHandle($phid)->renderHovercardLink();
|
||||
} else {
|
||||
return $this->getHandle($phid)->getLinkName();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue