diff --git a/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php b/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php index f2b957f363..6ecf0a9bd9 100644 --- a/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php +++ b/src/applications/people/event/PhabricatorPeopleHovercardEventListener.php @@ -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); } diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index 0c7ef73b0e..e66a34d9a1 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -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;