mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-30 16:30:45 +00:00
Update LikeController
This commit is contained in:
parent
46bc5322f3
commit
fec7ee8505
1 changed files with 7 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Auth, Hashids;
|
use Auth, Cache, Hashids;
|
||||||
use App\{Like, Profile, Status, User};
|
use App\{Like, Profile, Status, User};
|
||||||
use App\Jobs\LikePipeline\LikePipeline;
|
use App\Jobs\LikePipeline\LikePipeline;
|
||||||
|
|
||||||
|
@ -38,6 +38,12 @@ class LikeController extends Controller
|
||||||
LikePipeline::dispatch($like);
|
LikePipeline::dispatch($like);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$likes = Like::whereProfileId($profile->id)
|
||||||
|
->orderBy('id', 'desc')
|
||||||
|
->take(1000)
|
||||||
|
->pluck('status_id');
|
||||||
|
|
||||||
|
Cache::put('api:like-ids:user:'.$profile->id, $likes, 1440);
|
||||||
|
|
||||||
if($request->ajax()) {
|
if($request->ajax()) {
|
||||||
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
|
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
|
||||||
|
|
Loading…
Reference in a new issue