]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Autocomplete/actions/autocomplete.php
Autocomplete: Fix $profile being null for groups
[quix0rs-gnu-social.git] / plugins / Autocomplete / actions / autocomplete.php
index 56df4eb6d8b6c205c2775745d33ab2297a01c238..29921a5564a377db07c9fc79cfde3cc33b22d919 100644 (file)
@@ -141,25 +141,32 @@ class AutocompleteAction extends Action
         $results = array();
         foreach($this->profiles as $profile){
             $avatarUrl = $profile->avatarUrl(AVATAR_MINI_SIZE);
+            $acct = $profile->getAcctUri();
+            $identifier = split(':', $profile->getAcctUri(), 2)[1];
             $results[] = array(
-                'value' => '@'.$profile->nickname,
-                'nickname' => $profile->nickname,
-                'label'=> $profile->getFancyName(),
+                'value' => '@'.$identifier,
+                'nickname' => $profile->getNickname(),
+                'acct_uri' => $acct,
+                'label'=> "${identifier} (".$profile->getFullname().")",
                 'avatar' => $avatarUrl,
                 'type' => 'user'
             );
         }
         foreach($this->groups as $group){
+            $profile = $group->getProfile();
             // sigh.... encapsulate this upstream!
             if ($group->mini_logo) {
                 $avatarUrl = $group->mini_logo;
             } else {
                 $avatarUrl = User_group::defaultLogo(AVATAR_MINI_SIZE);
             }
+            $acct = $profile->getAcctUri();
+            $identifier = split(':', $profile->getAcctUri(), 2)[1];
             $results[] = array(
-                'value' => '!'.$group->nickname,
-                'nickname' => $group->nickname,
-                'label'=> $group->getFancyName(),
+                'value' => '!'.$group->getNickname(),
+                'nickname' => $group->getNickname(),
+                'acct_uri' => $acct,
+                'label'=> "${identifier} (".$group->getFullname().")",
                 'avatar' => $avatarUrl,
                 'type' => 'group');
         }