mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update InternalApiController
This commit is contained in:
parent
d15e8f12bd
commit
842adcda24
1 changed files with 0 additions and 59 deletions
|
@ -63,17 +63,6 @@ class InternalApiController extends Controller
|
|||
});
|
||||
$following = array_merge($following, $filters);
|
||||
|
||||
$people = Profile::select('id', 'name', 'username')
|
||||
->with('avatar')
|
||||
->whereNull('status')
|
||||
->orderByRaw('rand()')
|
||||
->whereHas('statuses')
|
||||
->whereNull('domain')
|
||||
->whereNotIn('id', $following)
|
||||
->whereIsPrivate(false)
|
||||
->take(3)
|
||||
->get();
|
||||
|
||||
$posts = Status::select('id', 'caption', 'profile_id')
|
||||
->whereHas('media')
|
||||
->whereIsNsfw(false)
|
||||
|
@ -85,15 +74,6 @@ class InternalApiController extends Controller
|
|||
->get();
|
||||
|
||||
$res = [
|
||||
'people' => $people->map(function($profile) {
|
||||
return [
|
||||
'id' => $profile->id,
|
||||
'avatar' => $profile->avatarUrl(),
|
||||
'name' => $profile->name,
|
||||
'username' => $profile->username,
|
||||
'url' => $profile->url(),
|
||||
];
|
||||
}),
|
||||
'posts' => $posts->map(function($post) {
|
||||
return [
|
||||
'url' => $post->url(),
|
||||
|
@ -104,45 +84,6 @@ class InternalApiController extends Controller
|
|||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
public function discoverPeople(Request $request)
|
||||
{
|
||||
$profile = Auth::user()->profile;
|
||||
$pid = $profile->id;
|
||||
$following = Cache::remember('feature:discover:following:'.$pid, now()->addMinutes(60), function() use ($pid) {
|
||||
return Follower::whereProfileId($pid)->pluck('following_id')->toArray();
|
||||
});
|
||||
$filters = Cache::remember("user:filter:list:$pid", now()->addMinutes(60), function() use($pid) {
|
||||
return UserFilter::whereUserId($pid)
|
||||
->whereFilterableType('App\Profile')
|
||||
->whereIn('filter_type', ['mute', 'block'])
|
||||
->pluck('filterable_id')->toArray();
|
||||
});
|
||||
$following = array_merge($following, $filters);
|
||||
|
||||
$people = Profile::select('id', 'name', 'username')
|
||||
->with('avatar')
|
||||
->orderByRaw('rand()')
|
||||
->whereHas('statuses')
|
||||
->whereNull('domain')
|
||||
->whereNotIn('id', $following)
|
||||
->whereIsPrivate(false)
|
||||
->take(3)
|
||||
->get();
|
||||
|
||||
$res = [
|
||||
'people' => $people->map(function($profile) {
|
||||
return [
|
||||
'id' => $profile->id,
|
||||
'avatar' => $profile->avatarUrl(),
|
||||
'name' => $profile->name,
|
||||
'username' => $profile->username,
|
||||
'url' => $profile->url(),
|
||||
];
|
||||
})
|
||||
];
|
||||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
public function discoverPosts(Request $request)
|
||||
{
|
||||
$profile = Auth::user()->profile;
|
||||
|
|
Loading…
Reference in a new issue