mirror of https://github.com/pixelfed/pixelfed.git
Update LikePipeline
This commit is contained in:
parent
6889fffbfb
commit
b995af15f6
|
@ -11,13 +11,11 @@ use App\Services\StatusService;
|
||||||
use App\Transformer\ActivityPub\Verb\Like as LikeTransformer;
|
use App\Transformer\ActivityPub\Verb\Like as LikeTransformer;
|
||||||
use App\User;
|
use App\User;
|
||||||
use App\Util\ActivityPub\Helpers;
|
use App\Util\ActivityPub\Helpers;
|
||||||
use DB;
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Lottery;
|
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
use League\Fractal\Serializer\ArraySerializer;
|
use League\Fractal\Serializer\ArraySerializer;
|
||||||
|
|
||||||
|
@ -65,17 +63,6 @@ class LikePipeline implements ShouldQueue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Lottery::odds(1, 20)
|
|
||||||
->winner(function () use ($status) {
|
|
||||||
$status->likes_count = DB::table('likes')->whereStatusId($status->id)->count();
|
|
||||||
$status->save();
|
|
||||||
})
|
|
||||||
->loser(function () use ($status) {
|
|
||||||
$status->likes_count = $status->likes_count + 1;
|
|
||||||
$status->save();
|
|
||||||
})
|
|
||||||
->choose();
|
|
||||||
|
|
||||||
StatusService::refresh($status->id);
|
StatusService::refresh($status->id);
|
||||||
|
|
||||||
if ($status->url && $actor->domain == null) {
|
if ($status->url && $actor->domain == null) {
|
||||||
|
|
Loading…
Reference in New Issue