Full identifiers for Autocomplete, less confusing

This commit is contained in:
Mikael Nordfeldth 2015-12-05 16:18:59 +01:00
parent 376d545082
commit 4fecda58ff
1 changed files with 12 additions and 6 deletions

View File

@ -141,10 +141,13 @@ class AutocompleteAction extends Action
$results = array(); $results = array();
foreach($this->profiles as $profile){ foreach($this->profiles as $profile){
$avatarUrl = $profile->avatarUrl(AVATAR_MINI_SIZE); $avatarUrl = $profile->avatarUrl(AVATAR_MINI_SIZE);
$acct = $profile->getAcctUri();
$identifier = split(':', $profile->getAcctUri(), 2)[1];
$results[] = array( $results[] = array(
'value' => '@'.$profile->nickname, 'value' => '@'.$identifier,
'nickname' => $profile->nickname, 'nickname' => $profile->getNickname(),
'label'=> $profile->getFancyName(), 'acct_uri' => $acct,
'label'=> "${identifier} (".$profile->getFullname().")",
'avatar' => $avatarUrl, 'avatar' => $avatarUrl,
'type' => 'user' 'type' => 'user'
); );
@ -156,10 +159,13 @@ class AutocompleteAction extends Action
} else { } else {
$avatarUrl = User_group::defaultLogo(AVATAR_MINI_SIZE); $avatarUrl = User_group::defaultLogo(AVATAR_MINI_SIZE);
} }
$acct = $profile->getAcctUri();
$identifier = split(':', $profile->getAcctUri(), 2)[1];
$results[] = array( $results[] = array(
'value' => '!'.$group->nickname, 'value' => '!'.$group->getNickname(),
'nickname' => $group->nickname, 'nickname' => $group->getNickname(),
'label'=> $group->getFancyName(), 'acct_uri' => $acct,
'label'=> "${identifier} (".$group->getFullname().")",
'avatar' => $avatarUrl, 'avatar' => $avatarUrl,
'type' => 'group'); 'type' => 'group');
} }