Make no_avatar filter work in the SQL part
This commit is contained in:
parent
a536c8c1c0
commit
87158897ad
|
@ -24,6 +24,7 @@ $sql_all = '
|
|||
{userFilter}
|
||||
{userLocalWhere1}
|
||||
{userLocalWhere2}
|
||||
{noAvatarWhere}
|
||||
a.suspended_at IS NULL
|
||||
ORDER BY a.updated_at DESC
|
||||
';
|
||||
|
@ -54,6 +55,13 @@ switch ($user_filter) {
|
|||
$sql_all = str_replace('{userLocalWhere2}', '', $sql_all);
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($_GET['no_avatar']))
|
||||
$sql_all = str_replace('{noAvatarWhere}', 'a.avatar_file_name IS NULL AND', $sql_all);
|
||||
else
|
||||
$sql_all = str_replace('{noAvatarWhere}', '', $sql_all);
|
||||
|
||||
|
||||
$all_accounts = $pg->fetch_all($sql_all);
|
||||
|
||||
if (isset($_GET['profile']) && trim($_GET['profile']) != '')
|
||||
|
@ -137,8 +145,6 @@ foreach ($filtered_accounts as $id) {
|
|||
$newacc['avatar'] .= '/cache';
|
||||
$newacc['avatar'] .= '/accounts/avatars/'.implode('/',$parts).'/original/'.$account['avatar_file_name'];
|
||||
}
|
||||
if (isset($_GET['no_avatar']) && $newacc['avatar'] !== null)
|
||||
continue;
|
||||
|
||||
$following = $pg->fetch_one('SELECT count(1) FROM follows WHERE account_id = \''.$id.'\'');
|
||||
$newacc['following'] = intval($following['count']);
|
||||
|
|
Loading…
Reference in New Issue