summaryrefslogtreecommitdiff
path: root/plugins/Autocomplete/autocomplete.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Autocomplete/autocomplete.php')
-rw-r--r--plugins/Autocomplete/autocomplete.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/plugins/Autocomplete/autocomplete.php b/plugins/Autocomplete/autocomplete.php
index be5b51a19..c4b30d264 100644
--- a/plugins/Autocomplete/autocomplete.php
+++ b/plugins/Autocomplete/autocomplete.php
@@ -126,10 +126,32 @@ class AutocompleteAction extends Action
$results = array();
foreach($this->users as $user){
$profile = $user->getProfile();
- $results[]=array('nickname' => $user->nickname, 'fullname'=> $profile->fullname, 'type'=>'user');
+ $avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
+ // sigh.... encapsulate this upstream!
+ if ($avatar) {
+ $avatar = $avatar->displayUrl();
+ } else {
+ $avatar = Avatar::defaultImage(AVATAR_MINI_SIZE);
+ }
+ $results[] = array(
+ 'nickname' => $user->nickname,
+ 'fullname'=> $profile->fullname,
+ 'avatar' => $avatar,
+ 'type' => 'user'
+ );
}
foreach($this->groups as $group){
- $results[]=array('nickname' => $group->nickname, 'fullname'=> $group->fullname, 'type'=>'group');
+ // sigh.... encapsulate this upstream!
+ if ($group->mini_logo) {
+ $avatar = $group->mini_logo;
+ } else {
+ $avatar = User_group::defaultLogo(AVATAR_MINI_SIZE);
+ }
+ $results[] = array(
+ 'nickname' => $group->nickname,
+ 'fullname'=> $group->fullname,
+ 'avatar' => $avatar,
+ 'type' => 'group');
}
foreach($results as $result) {
print json_encode($result) . "\n";