Autocomplete: don't match non-subscribed group-names.

There's no point, since we can't post/link to them anyway.
This commit is contained in:
Joshua Judson Rosen 2014-04-29 23:35:46 -04:00 committed by Mikael Nordfeldth
parent 9a5e1423f1
commit 4fd3f43ad2

View File

@ -128,6 +128,9 @@ class AutocompleteAction extends Action
$group = new User_group(); $group = new User_group();
$group->limit($limit); $group->limit($limit);
$group->whereAdd('nickname like \'' . trim($group->escape($term), '\'') . '%\''); $group->whereAdd('nickname like \'' . trim($group->escape($term), '\'') . '%\'');
//Can't post to groups we're not subscribed to...:
$group->whereAdd('id in (SELECT group_id from group_member'
. ' where profile_id = ' . $cur->id . ')');
if($group->find()){ if($group->find()){
while($group->fetch()) { while($group->fetch()) {
$this->groups[]=clone($group); $this->groups[]=clone($group);