mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update Like model, bump max likes per day from 100 to 200
This commit is contained in:
parent
0df629728e
commit
71ba5fedc2
3 changed files with 9 additions and 1 deletions
|
@ -1061,7 +1061,7 @@ class ApiV1Controller extends Controller
|
||||||
abort_if(
|
abort_if(
|
||||||
Like::whereProfileId($user->profile_id)
|
Like::whereProfileId($user->profile_id)
|
||||||
->where('created_at', '>', now()->subDay())
|
->where('created_at', '>', now()->subDay())
|
||||||
->count() >= 100,
|
->count() >= Like::MAX_PER_DAY,
|
||||||
429
|
429
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,12 @@ class LikeController extends Controller
|
||||||
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
|
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
|
||||||
UnlikePipeline::dispatch($like);
|
UnlikePipeline::dispatch($like);
|
||||||
} else {
|
} 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();
|
$count = $status->likes_count > 4 ? $status->likes_count : $status->likes()->count();
|
||||||
$like = Like::firstOrCreate([
|
$like = Like::firstOrCreate([
|
||||||
'profile_id' => $user->profile_id,
|
'profile_id' => $user->profile_id,
|
||||||
|
|
|
@ -9,6 +9,8 @@ class Like extends Model
|
||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
|
const MAX_PER_DAY = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be mutated to dates.
|
* The attributes that should be mutated to dates.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue