mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update LikeController
This commit is contained in:
parent
f033f84159
commit
7974ad39c9
1 changed files with 1 additions and 5 deletions
|
@ -20,14 +20,12 @@ class LikeController extends Controller
|
|||
public function store(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'item' => 'required|integer',
|
||||
'item' => 'required|integer|min:1',
|
||||
]);
|
||||
|
||||
$profile = Auth::user()->profile;
|
||||
$status = Status::withCount('likes')->findOrFail($request->input('item'));
|
||||
|
||||
Cache::forget('transform:status:'.$status->url());
|
||||
|
||||
$count = $status->likes_count;
|
||||
|
||||
if ($status->likes()->whereProfileId($profile->id)->count() !== 0) {
|
||||
|
@ -48,8 +46,6 @@ class LikeController extends Controller
|
|||
->take(1000)
|
||||
->pluck('status_id');
|
||||
|
||||
Cache::put('api:like-ids:user:'.$profile->id, $likes, now()->addMinutes(1440));
|
||||
|
||||
if ($request->ajax()) {
|
||||
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue