mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
commit
f89da82dbc
2 changed files with 4 additions and 6 deletions
|
@ -3403,10 +3403,9 @@ class ApiV1Controller extends Controller
|
|||
$limitKey = 'compose:rate-limit:store:'.$user->id;
|
||||
$limitTtl = now()->addMinutes(15);
|
||||
$limitReached = Cache::remember($limitKey, $limitTtl, function () use ($user) {
|
||||
$minId = SnowflakeService::byDate(now()->subDays(1));
|
||||
$dailyLimit = Status::whereProfileId($user->profile_id)
|
||||
->whereNull('in_reply_to_id')
|
||||
->whereNull('reblog_of_id')
|
||||
->where('created_at', '>', now()->subDays(1))
|
||||
->where('id', '>', $minId)
|
||||
->count();
|
||||
|
||||
return $dailyLimit >= 1000;
|
||||
|
|
|
@ -202,15 +202,14 @@ class AccountService
|
|||
}
|
||||
|
||||
$count = Status::whereProfileId($id)
|
||||
->whereNull('in_reply_to_id')
|
||||
->whereNull('reblog_of_id')
|
||||
->whereNull(['in_reply_to_id','reblog_of_id'])
|
||||
->whereIn('scope', ['public', 'unlisted', 'private'])
|
||||
->count();
|
||||
|
||||
$profile->status_count = $count;
|
||||
$profile->save();
|
||||
|
||||
Cache::put($key, 1, 900);
|
||||
Cache::put($key, 1, 259200);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue