mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update LikePipeline jobs, fix likes_count calculation
This commit is contained in:
parent
a641d3a32c
commit
fe64e18712
2 changed files with 7 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Jobs\LikePipeline;
|
||||
|
||||
use Cache, Log;
|
||||
use Cache, DB, Log;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use App\{Like, Notification};
|
||||
use Illuminate\Bus\Queueable;
|
||||
|
@ -59,6 +59,9 @@ class LikePipeline implements ShouldQueue
|
|||
return;
|
||||
}
|
||||
|
||||
$status->likes_count = DB::table('likes')->whereStatusId($status->id)->count();
|
||||
$status->save();
|
||||
|
||||
StatusService::refresh($status->id);
|
||||
|
||||
if($status->url && $actor->domain == null) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace App\Jobs\LikePipeline;
|
||||
|
||||
use Cache, Log;
|
||||
use Cache, DB, Log;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use App\{Like, Notification};
|
||||
use Illuminate\Bus\Queueable;
|
||||
|
@ -59,9 +59,8 @@ class UnlikePipeline implements ShouldQueue
|
|||
return;
|
||||
}
|
||||
|
||||
$count = $status->likes_count > 1 ? $status->likes_count : $status->likes()->count();
|
||||
$status->likes_count = $count - 1;
|
||||
$status->save();
|
||||
$status->likes_count = DB::table('likes')->whereStatusId($status->id)->count();
|
||||
$status->save();
|
||||
|
||||
StatusService::refresh($status->id);
|
||||
|
||||
|
|
Loading…
Reference in a new issue