mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +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;
|
namespace App\Jobs\LikePipeline;
|
||||||
|
|
||||||
use Cache, Log;
|
use Cache, DB, Log;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
use App\{Like, Notification};
|
use App\{Like, Notification};
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
|
@ -59,6 +59,9 @@ class LikePipeline implements ShouldQueue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$status->likes_count = DB::table('likes')->whereStatusId($status->id)->count();
|
||||||
|
$status->save();
|
||||||
|
|
||||||
StatusService::refresh($status->id);
|
StatusService::refresh($status->id);
|
||||||
|
|
||||||
if($status->url && $actor->domain == null) {
|
if($status->url && $actor->domain == null) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Jobs\LikePipeline;
|
namespace App\Jobs\LikePipeline;
|
||||||
|
|
||||||
use Cache, Log;
|
use Cache, DB, Log;
|
||||||
use Illuminate\Support\Facades\Redis;
|
use Illuminate\Support\Facades\Redis;
|
||||||
use App\{Like, Notification};
|
use App\{Like, Notification};
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
|
@ -59,8 +59,7 @@ class UnlikePipeline implements ShouldQueue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = $status->likes_count > 1 ? $status->likes_count : $status->likes()->count();
|
$status->likes_count = DB::table('likes')->whereStatusId($status->id)->count();
|
||||||
$status->likes_count = $count - 1;
|
|
||||||
$status->save();
|
$status->save();
|
||||||
|
|
||||||
StatusService::refresh($status->id);
|
StatusService::refresh($status->id);
|
||||||
|
|
Loading…
Reference in a new issue