forked from mirror/pixelfed
Update StatusController, improve share api perf (11s to 72ms)
This commit is contained in:
parent
3741c76da3
commit
d48ebb829c
1 changed files with 4 additions and 5 deletions
|
@ -237,16 +237,15 @@ class StatusController extends Controller
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$profile = $user->profile;
|
$profile = $user->profile;
|
||||||
$status = Status::withCount('shares')
|
$status = Status::whereIn('scope', ['public', 'unlisted'])
|
||||||
->whereIn('scope', ['public', 'unlisted'])
|
|
||||||
->findOrFail($request->input('item'));
|
->findOrFail($request->input('item'));
|
||||||
|
|
||||||
$count = $status->shares()->count();
|
$count = $status->reblogs_count;
|
||||||
|
|
||||||
$exists = Status::whereProfileId(Auth::user()->profile->id)
|
$exists = Status::whereProfileId(Auth::user()->profile->id)
|
||||||
->whereReblogOfId($status->id)
|
->whereReblogOfId($status->id)
|
||||||
->count();
|
->exists();
|
||||||
if ($exists !== 0) {
|
if ($exists == true) {
|
||||||
$shares = Status::whereProfileId(Auth::user()->profile->id)
|
$shares = Status::whereProfileId(Auth::user()->profile->id)
|
||||||
->whereReblogOfId($status->id)
|
->whereReblogOfId($status->id)
|
||||||
->get();
|
->get();
|
||||||
|
|
Loading…
Reference in a new issue