Replace text with nickname if shorter
This commit is contained in:
parent
0aa759fab7
commit
fe4c8a771b
|
@ -278,9 +278,11 @@ class OStatusPlugin extends Plugin
|
|||
$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());
|
||||
|
@ -306,9 +308,11 @@ class OStatusPlugin extends Plugin
|
|||
$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());
|
||||
|
|
Loading…
Reference in New Issue
Block a user