Merge pull request #4690 from pixelfed/staging

Update NotificationService, handle empty epoch. Fixes #4689
This commit is contained in:
daniel 2023-10-10 19:14:12 -06:00 committed by GitHub
commit a276b2ce70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,6 +49,9 @@ class NotificationService {
public static function getEpochId($months = 6)
{
return Cache::remember(self::EPOCH_CACHE_KEY . $months, 1209600, function() use($months) {
if(Notification::count() === 0) {
return 0;
}
return Notification::where('created_at', '>', now()->subMonths($months))->first()->id;
});
}