mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Merge pull request #4725 from pixelfed/staging
Update LikePipeline, dispatch to feed queue. Fixes #4723
This commit is contained in:
commit
4b9d0dc6ef
3 changed files with 6 additions and 7 deletions
|
@ -1271,7 +1271,7 @@ class ApiV1Controller extends Controller
|
||||||
Status::findOrFail($status['id'])->update([
|
Status::findOrFail($status['id'])->update([
|
||||||
'likes_count' => ($status['favourites_count'] ?? 0) + 1
|
'likes_count' => ($status['favourites_count'] ?? 0) + 1
|
||||||
]);
|
]);
|
||||||
LikePipeline::dispatch($like);
|
LikePipeline::dispatch($like)->onQueue('feed');
|
||||||
}
|
}
|
||||||
|
|
||||||
$status['favourited'] = true;
|
$status['favourited'] = true;
|
||||||
|
@ -1308,7 +1308,7 @@ class ApiV1Controller extends Controller
|
||||||
|
|
||||||
if($like) {
|
if($like) {
|
||||||
$like->forceDelete();
|
$like->forceDelete();
|
||||||
$status->likes_count = $status->likes()->count();
|
$status->likes_count = $status->likes_count > 1 ? $status->likes_count - 1 : 0;
|
||||||
$status->save();
|
$status->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,7 @@ class LikeController extends Controller
|
||||||
'item' => 'required|integer|min:1',
|
'item' => 'required|integer|min:1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// API deprecated
|
abort(422, 'Deprecated API Endpoint');
|
||||||
return;
|
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$profile = $user->profile;
|
$profile = $user->profile;
|
||||||
|
@ -34,7 +33,7 @@ class LikeController extends Controller
|
||||||
|
|
||||||
if (Like::whereStatusId($status->id)->whereProfileId($profile->id)->exists()) {
|
if (Like::whereStatusId($status->id)->whereProfileId($profile->id)->exists()) {
|
||||||
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
|
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
|
||||||
UnlikePipeline::dispatch($like);
|
UnlikePipeline::dispatch($like)->onQueue('feed');
|
||||||
} else {
|
} else {
|
||||||
abort_if(
|
abort_if(
|
||||||
Like::whereProfileId($user->profile_id)
|
Like::whereProfileId($user->profile_id)
|
||||||
|
@ -60,7 +59,7 @@ class LikeController extends Controller
|
||||||
]) == false;
|
]) == false;
|
||||||
$like->save();
|
$like->save();
|
||||||
$status->save();
|
$status->save();
|
||||||
LikePipeline::dispatch($like);
|
LikePipeline::dispatch($like)->onQueue('feed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class DeleteRemoteStatusPipeline implements ShouldQueue
|
||||||
$status = $this->status;
|
$status = $this->status;
|
||||||
|
|
||||||
if(AccountService::get($status->profile_id, true)) {
|
if(AccountService::get($status->profile_id, true)) {
|
||||||
DecrementPostCount::dispatch($status->profile_id)->onQueue('feed');
|
DecrementPostCount::dispatch($status->profile_id)->onQueue('low');
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkTimelineService::del($status->id);
|
NetworkTimelineService::del($status->id);
|
||||||
|
|
Loading…
Reference in a new issue