Merge pull request #10869 from MrPetovan/bug/10868-mastodon-api-notifications

Ignore max_id when it's 0 or less in BaseDepository->_selectByBoundaries
This commit is contained in:
Michael Vogel 2021-10-13 06:57:25 +02:00 committed by GitHub
commit e2400067a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -87,7 +87,7 @@ abstract class BaseDepository
} }
} }
if (isset($max_id)) { if (isset($max_id) && $max_id > 0) {
$boundCondition = DBA::mergeConditions($boundCondition, ['`id` < ?', $max_id]); $boundCondition = DBA::mergeConditions($boundCondition, ['`id` < ?', $max_id]);
if (!isset($min_id) && (!isset($params['order']['id']) || $params['order']['id'] === false || $params['order']['id'] === 'ASC')) { if (!isset($min_id) && (!isset($params['order']['id']) || $params['order']['id'] === false || $params['order']['id'] === 'ASC')) {
$reverseOrder = true; $reverseOrder = true;

View File

@ -124,8 +124,8 @@ class Notifications extends BaseApi
$Notifications = DI::notification()->selectByBoundaries( $Notifications = DI::notification()->selectByBoundaries(
$condition, $condition,
$params, $params,
$request['min_id'] ?? null, $request['min_id'] ?: $request['since_id'],
$request['min_id'] ?? $request['since_id'] ?? null, $request['max_id'],
$request['limit'] $request['limit']
); );