Update Like model, bump max likes per day from 100 to 200

pull/3430/head
Daniel Supernault 2022-05-09 00:33:01 -06:00
rodzic 0df629728e
commit 71ba5fedc2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
3 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -1061,7 +1061,7 @@ class ApiV1Controller extends Controller
abort_if(
Like::whereProfileId($user->profile_id)
->where('created_at', '>', now()->subDay())
->count() >= 100,
->count() >= Like::MAX_PER_DAY,
429
);

Wyświetl plik

@ -33,6 +33,12 @@ class LikeController extends Controller
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
UnlikePipeline::dispatch($like);
} else {
abort_if(
Like::whereProfileId($user->profile_id)
->where('created_at', '>', now()->subDay())
->count() >= Like::MAX_PER_DAY,
429
);
$count = $status->likes_count > 4 ? $status->likes_count : $status->likes()->count();
$like = Like::firstOrCreate([
'profile_id' => $user->profile_id,

Wyświetl plik

@ -9,6 +9,8 @@ class Like extends Model
{
use SoftDeletes;
const MAX_PER_DAY = 200;
/**
* The attributes that should be mutated to dates.
*