[Autocomplete] Fix postgres incompatible query in AutocompleteAction

This commit is contained in:
susdiv 2020-06-05 19:14:37 +00:00 committed by Diogo Peralta Cordeiro
parent 2a82f2774d
commit 6ea0d441cd

View File

@ -104,12 +104,13 @@ class AutocompleteAction extends Action
if(substr($term,0,1)=='@'){
//profile search
$term=substr($term,1);
$user_table = common_database_tablename('user');
$profile = new Profile();
$profile->limit($limit);
$profile->whereAdd('nickname like \'' . trim($profile->escape($term), '\'') . '%\'');
$profile->whereAdd(sprintf('id in (SELECT id FROM user) OR '
$profile->whereAdd(sprintf('id in (SELECT id FROM %s) OR '
. 'id in (SELECT subscribed from subscription'
. ' where subscriber = %d)', $this->scoped->id));
. ' where subscriber = %d)', $user_table, $this->scoped->id));
if ($profile->find()) {
while($profile->fetch()) {
$this->profiles[]=clone($profile);