Use a better function to add the element to the beginning of the array

2022.09-rc
Michael 2021-01-17 13:10:32 +00:00
rodzic 5adc150d7a
commit 0c8bb0bc18
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -2171,17 +2171,17 @@ function api_statuses_mentions($type)
$start = max(0, ($page - 1) * $count); $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(), $condition = [GRAVITY_PARENT, GRAVITY_COMMENT, api_user(),
UserItem::NOTIF_EXPLICIT_TAGGED | UserItem::NOTIF_IMPLICIT_TAGGED | UserItem::NOTIF_EXPLICIT_TAGGED | UserItem::NOTIF_IMPLICIT_TAGGED |
UserItem::NOTIF_THREAD_COMMENT | UserItem::NOTIF_DIRECT_COMMENT | UserItem::NOTIF_THREAD_COMMENT | UserItem::NOTIF_DIRECT_COMMENT |
UserItem::NOTIF_DIRECT_THREAD_COMMENT, UserItem::NOTIF_DIRECT_THREAD_COMMENT,
$since_id]; $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) { if ($max_id > 0) {
$query .= " AND `iid` <= ?"; $query .= " AND `iid` <= ?";
$condition[] = $max_id; $condition[] = $max_id;
@ -2189,7 +2189,7 @@ function api_statuses_mentions($type)
$query .= ")"; $query .= ")";
$condition = array_merge([$query], $condition); array_unshift($condition, $query);
$params = ['order' => ['id' => true], 'limit' => [$start, $count]]; $params = ['order' => ['id' => true], 'limit' => [$start, $count]];
$statuses = Post::selectForUser(api_user(), [], $condition, $params); $statuses = Post::selectForUser(api_user(), [], $condition, $params);