mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 21:13:16 +00:00
Merge pull request #4690 from pixelfed/staging
Update NotificationService, handle empty epoch. Fixes #4689
This commit is contained in:
commit
a276b2ce70
1 changed files with 3 additions and 0 deletions
|
@ -49,6 +49,9 @@ class NotificationService {
|
||||||
public static function getEpochId($months = 6)
|
public static function getEpochId($months = 6)
|
||||||
{
|
{
|
||||||
return Cache::remember(self::EPOCH_CACHE_KEY . $months, 1209600, function() use($months) {
|
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;
|
return Notification::where('created_at', '>', now()->subMonths($months))->first()->id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue