From 0c8bb0bc18a1cc8b381b077618d0818d9cd6dd85 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 17 Jan 2021 13:10:32 +0000 Subject: [PATCH] Use a better function to add the element to the beginning of the array --- include/api.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/api.php b/include/api.php index 31cffc180b..63df897ee0 100644 --- a/include/api.php +++ b/include/api.php @@ -2171,17 +2171,17 @@ function api_statuses_mentions($type) $start = max(0, ($page - 1) * $count); + $query = "`gravity` IN (?, ?) AND `id` IN (SELECT `iid` FROM `user-item` + WHERE (`hidden` IS NULL OR NOT `hidden`) AND + `uid` = ? AND `notification-type` & ? != 0 + AND `iid` > ?"; + $condition = [GRAVITY_PARENT, GRAVITY_COMMENT, api_user(), UserItem::NOTIF_EXPLICIT_TAGGED | UserItem::NOTIF_IMPLICIT_TAGGED | UserItem::NOTIF_THREAD_COMMENT | UserItem::NOTIF_DIRECT_COMMENT | UserItem::NOTIF_DIRECT_THREAD_COMMENT, $since_id]; - $query = "`gravity` IN (?, ?) AND `id` IN (SELECT `iid` FROM `user-item` - WHERE (`hidden` IS NULL OR NOT `hidden`) AND - `uid` = ? AND `notification-type` & ? != 0 - AND `iid` > ?"; - if ($max_id > 0) { $query .= " AND `iid` <= ?"; $condition[] = $max_id; @@ -2189,7 +2189,7 @@ function api_statuses_mentions($type) $query .= ")"; - $condition = array_merge([$query], $condition); + array_unshift($condition, $query); $params = ['order' => ['id' => true], 'limit' => [$start, $count]]; $statuses = Post::selectForUser(api_user(), [], $condition, $params);