Merge branch 'autocomplete-group' into 'nightly'

Autocomplete group

Group autocompletion wasn't working for a couple of reasons:

1. $profile wasn't set (d8092207c0)
2. Profile::getUri() wasn't working for Groups, causing Profile::getAcctUri() to throw a ProfileNoAcctUriException (3e830dad37)

See merge request !68
This commit is contained in:
mmn 2015-12-23 21:04:18 +00:00
commit 48f31928e9
2 changed files with 6 additions and 0 deletions

View File

@ -1439,6 +1439,11 @@ class Profile extends Managed_DataObject
$user = User::getKV('id', $this->id); $user = User::getKV('id', $this->id);
if ($user instanceof User) { if ($user instanceof User) {
$uri = $user->getUri(); $uri = $user->getUri();
} else {
$group = User_group::getKV('profile_id', $this->id);
if ($group instanceof User_group) {
$uri = $group->getUri();
}
} }
Event::handle('EndGetProfileUri', array($this, &$uri)); Event::handle('EndGetProfileUri', array($this, &$uri));

View File

@ -153,6 +153,7 @@ class AutocompleteAction extends Action
); );
} }
foreach($this->groups as $group){ foreach($this->groups as $group){
$profile = $group->getProfile();
// sigh.... encapsulate this upstream! // sigh.... encapsulate this upstream!
if ($group->mini_logo) { if ($group->mini_logo) {
$avatarUrl = $group->mini_logo; $avatarUrl = $group->mini_logo;