$oprofile = Ostatus_profile::ensureWebfinger($target);
if ($oprofile instanceof Ostatus_profile && !$oprofile->isGroup()) {
$profile = $oprofile->localProfile();
+ $text = !empty($profile->nickname) && strlen($profile->nickname) < strlen($target) ?
+ $profile->nickname : $target;
$matches[$pos] = array('mentioned' => array($profile),
'type' => 'mention',
- 'text' => $target,
+ 'text' => $text,
'position' => $pos,
'length' => mb_strlen($target),
'url' => $profile->getUrl());
$oprofile = Ostatus_profile::ensureProfileURL($url);
if ($oprofile instanceof Ostatus_profile && !$oprofile->isGroup()) {
$profile = $oprofile->localProfile();
+ $text = !empty($profile->nickname) && strlen($profile->nickname) < strlen($target) ?
+ $profile->nickname : $target;
$matches[$pos] = array('mentioned' => array($profile),
'type' => 'mention',
- 'text' => $target,
+ 'text' => $text,
'position' => $pos,
'length' => mb_strlen($target),
'url' => $profile->getUrl());