mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Merge pull request #2864 from pixelfed/staging
Update ApiController, fix notification bug
This commit is contained in:
commit
87a6f2cd6f
3 changed files with 12 additions and 8 deletions
|
@ -1289,13 +1289,17 @@ class ApiV1Controller extends Controller
|
||||||
if($max) {
|
if($max) {
|
||||||
$res = NotificationService::getMax($pid, $max, $limit);
|
$res = NotificationService::getMax($pid, $max, $limit);
|
||||||
$ids = NotificationService::getRankedMaxId($pid, $max, $limit);
|
$ids = NotificationService::getRankedMaxId($pid, $max, $limit);
|
||||||
$maxId = max($ids);
|
if(!empty($ids)) {
|
||||||
$minId = min($ids);
|
$maxId = max($ids);
|
||||||
|
$minId = min($ids);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$res = NotificationService::getMin($pid, $min ?? $since, $limit);
|
$res = NotificationService::getMin($pid, $min ?? $since, $limit);
|
||||||
$ids = NotificationService::getRankedMinId($pid, $min ?? $since, $limit);
|
$ids = NotificationService::getRankedMinId($pid, $min ?? $since, $limit);
|
||||||
$maxId = max($ids);
|
if(!empty($ids)) {
|
||||||
$minId = min($ids);
|
$maxId = max($ids);
|
||||||
|
$minId = min($ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseUrl = config('app.url') . '/api/v1/notifications?';
|
$baseUrl = config('app.url') . '/api/v1/notifications?';
|
||||||
|
|
|
@ -402,8 +402,8 @@ class PublicApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$filtered = $user ? UserFilterService::filters($user->profile_id) : [];
|
$filtered = $user ? UserFilterService::filters($user->profile_id) : [];
|
||||||
$textOnlyPosts = Redis::zscore('pf:tl:top', $pid) !== false;
|
$textOnlyPosts = (bool) Redis::zscore('pf:tl:top', $pid);
|
||||||
$textOnlyReplies = Redis::zscore('pf:tl:replies', $pid) !== false;
|
$textOnlyReplies = (bool) Redis::zscore('pf:tl:replies', $pid);
|
||||||
$types = $textOnlyPosts ?
|
$types = $textOnlyPosts ?
|
||||||
['text', 'photo', 'photo:album', 'video', 'video:album', 'photo:video:album'] :
|
['text', 'photo', 'photo:album', 'video', 'video:album', 'photo:video:album'] :
|
||||||
['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'];
|
['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'];
|
||||||
|
|
|
@ -241,13 +241,13 @@ class SettingsController extends Controller
|
||||||
if($top) {
|
if($top) {
|
||||||
Redis::zadd('pf:tl:top', $pid, $pid);
|
Redis::zadd('pf:tl:top', $pid, $pid);
|
||||||
} else {
|
} else {
|
||||||
Redis::zrem('pf:tl:top', $pid, $pid);
|
Redis::zrem('pf:tl:top', $pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($replies) {
|
if($replies) {
|
||||||
Redis::zadd('pf:tl:replies', $pid, $pid);
|
Redis::zadd('pf:tl:replies', $pid, $pid);
|
||||||
} else {
|
} else {
|
||||||
Redis::zrem('pf:tl:replies', $pid, $pid);
|
Redis::zrem('pf:tl:replies', $pid);
|
||||||
}
|
}
|
||||||
return redirect(route('settings.timeline'));
|
return redirect(route('settings.timeline'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue