mirror of
https://github.com/cydrobolt/polr.git
synced 2024-11-09 11:42:28 +01:00
Avoid link counting for unlimited quota
This commit is contained in:
parent
2068eba42b
commit
25094345d1
@ -23,11 +23,15 @@ class ApiHelper {
|
||||
$api_quota = env('SETTING_ANON_API_QUOTA') ?: 5;
|
||||
}
|
||||
|
||||
if ($api_quota == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$links_last_minute = Link::where('is_api', 1)
|
||||
->where('creator', $username)
|
||||
->where('created_at', '>=', $last_minute)
|
||||
->count();
|
||||
|
||||
return ($api_quota > -1 && $links_last_minute >= $api_quota);
|
||||
return $links_last_minute >= $api_quota;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user