1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00

People - fix hovercards for people

Summary: Fixes T8242. D12833 removed the title as well as the blurb from people hovercards. When re-adding the title don't bother throwing things through pht since that seems like not something you translate exactly and also lose the flavor text which most users end up having since title is rarely set (at least on this install).

Test Plan: viewed hovercards and saw title and blurb again as appropos relative to the data being set

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T8242

Differential Revision: https://secure.phabricator.com/D12915
This commit is contained in:
Bob Trahan 2015-05-18 15:39:34 -07:00
parent da4617aabd
commit 189c55d1d3
2 changed files with 18 additions and 1 deletions

View file

@ -31,10 +31,16 @@ final class PhabricatorPeopleHovercardEventListener
->setViewer($viewer)
->withIDs(array($user->getID()))
->needAvailability(true)
->needProfile(true)
->executeOne();
$hovercard->setTitle($user->getUsername());
$hovercard->setDetail($user->getRealName());
$profile = $user->getUserProfile();
$detail = $user->getRealName();
if ($profile->getTitle()) {
$detail .= ' - '.$profile->getTitle().'.';
}
$hovercard->setDetail($detail);
if ($user->getIsDisabled()) {
$hovercard->addField(pht('Account'), pht('Disabled'));
@ -52,6 +58,13 @@ final class PhabricatorPeopleHovercardEventListener
pht('User Since'),
phabricator_date($user->getDateCreated(), $viewer));
if ($profile->getBlurb()) {
$hovercard->addField(pht('Blurb'),
id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs(120)
->truncateString($profile->getBlurb()));
}
$event->setValue('hovercard', $hovercard);
}

View file

@ -396,6 +396,10 @@ final class PhabricatorUser
return substr(PhabricatorHash::digest($vec), 0, $len);
}
public function getUserProfile() {
return $this->assertAttached($this->profile);
}
public function attachUserProfile(PhabricatorUserProfile $profile) {
$this->profile = $profile;
return $this;