mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 09:43:16 +00:00
Update ApiV1Controller, add StatusService del calls to update likes_count, reblogs_count and reply_count
This commit is contained in:
parent
aa4c718d79
commit
05b9445c8f
1 changed files with 6 additions and 0 deletions
|
@ -50,6 +50,7 @@ use App\Services\{
|
||||||
NotificationService,
|
NotificationService,
|
||||||
MediaPathService,
|
MediaPathService,
|
||||||
SearchApiV2Service,
|
SearchApiV2Service,
|
||||||
|
StatusService,
|
||||||
MediaBlocklistService
|
MediaBlocklistService
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -856,6 +857,8 @@ class ApiV1Controller extends Controller
|
||||||
$status->save();
|
$status->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusService::del($status->id);
|
||||||
|
|
||||||
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
|
@ -1766,6 +1769,7 @@ class ApiV1Controller extends Controller
|
||||||
$status->in_reply_to_id = $parent->id;
|
$status->in_reply_to_id = $parent->id;
|
||||||
$status->in_reply_to_profile_id = $parent->profile_id;
|
$status->in_reply_to_profile_id = $parent->profile_id;
|
||||||
$status->save();
|
$status->save();
|
||||||
|
StatusService::del($parent->id);
|
||||||
} else if($ids) {
|
} else if($ids) {
|
||||||
if(Media::whereUserId($user->id)
|
if(Media::whereUserId($user->id)
|
||||||
->whereNull('status_id')
|
->whereNull('status_id')
|
||||||
|
@ -1883,6 +1887,7 @@ class ApiV1Controller extends Controller
|
||||||
SharePipeline::dispatch($share);
|
SharePipeline::dispatch($share);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusService::del($status->id);
|
||||||
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
|
@ -1916,6 +1921,7 @@ class ApiV1Controller extends Controller
|
||||||
$status->reblogs_count = $status->shares()->count();
|
$status->reblogs_count = $status->shares()->count();
|
||||||
$status->save();
|
$status->save();
|
||||||
|
|
||||||
|
StatusService::del($status->id);
|
||||||
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
|
|
Loading…
Reference in a new issue