mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-21 04:23:16 +00:00
Merge pull request #592 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
b69601a6f2
2 changed files with 31 additions and 34 deletions
|
@ -204,14 +204,9 @@ class AccountController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$pid = $user->id;
|
$pid = $user->id;
|
||||||
Cache::remember("user:filter:list:$pid", 1440, function() use($pid) {
|
Cache::forget("user:filter:list:$pid");
|
||||||
$private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
|
Cache::forget("feature:discover:people:$pid");
|
||||||
$filters = UserFilter::whereUserId($pid)
|
Cache::forget("feature:discover:posts:$pid");
|
||||||
->whereFilterableType('App\Profile')
|
|
||||||
->whereIn('filter_type', ['mute', 'block'])
|
|
||||||
->pluck('filterable_id')->toArray();
|
|
||||||
return array_merge($private->toArray(), $filters);
|
|
||||||
});
|
|
||||||
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
@ -258,14 +253,9 @@ class AccountController extends Controller
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$pid = $user->id;
|
$pid = $user->id;
|
||||||
Cache::remember("user:filter:list:$pid", 1440, function() use($pid) {
|
Cache::forget("user:filter:list:$pid");
|
||||||
$private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
|
Cache::forget("feature:discover:people:$pid");
|
||||||
$filters = UserFilter::whereUserId($pid)
|
Cache::forget("feature:discover:posts:$pid");
|
||||||
->whereFilterableType('App\Profile')
|
|
||||||
->whereIn('filter_type', ['mute', 'block'])
|
|
||||||
->pluck('filterable_id')->toArray();
|
|
||||||
return array_merge($private->toArray(), $filters);
|
|
||||||
});
|
|
||||||
return redirect()->back();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,16 +125,19 @@ class InternalApiController extends Controller
|
||||||
{
|
{
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
$pid = $profile->id;
|
$pid = $profile->id;
|
||||||
//$following = Cache::get('feature:discover:following:'.$profile->id, []);
|
$following = Cache::remember('feature:discover:following:'.$pid, 60, function() use ($pid) {
|
||||||
$following = Follower::whereProfileId($pid)->pluck('following_id');
|
return Follower::whereProfileId($pid)->pluck('following_id');
|
||||||
|
});
|
||||||
|
$filters = Cache::remember("user:filter:list:$pid", 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);
|
||||||
|
|
||||||
$filtered = UserFilter::whereUserId($pid)
|
$people = Cache::remember('feature:discover:people:'.$pid, 15, function() use ($following) {
|
||||||
->whereFilterableType('App\Profile')
|
return Profile::select('id', 'name', 'username')
|
||||||
->whereIn('filter_type', ['mute', 'block'])
|
|
||||||
->pluck('filterable_id')->toArray();
|
|
||||||
$following = array_merge($following->push($pid)->toArray(), $filtered);
|
|
||||||
|
|
||||||
$people = Profile::select('id', 'name', 'username')
|
|
||||||
->with('avatar')
|
->with('avatar')
|
||||||
->inRandomOrder()
|
->inRandomOrder()
|
||||||
->whereHas('statuses')
|
->whereHas('statuses')
|
||||||
|
@ -143,16 +146,20 @@ class InternalApiController extends Controller
|
||||||
->whereIsPrivate(false)
|
->whereIsPrivate(false)
|
||||||
->take(3)
|
->take(3)
|
||||||
->get();
|
->get();
|
||||||
|
});
|
||||||
|
|
||||||
$posts = Status::select('id', 'caption', 'profile_id')
|
$posts = Cache::remember('feature:discover:posts:'.$pid, 60, function() use ($following) {
|
||||||
->whereHas('media')
|
return Status::select('id', 'caption', 'profile_id')
|
||||||
->whereIsNsfw(false)
|
->whereNull('in_reply_to_id')
|
||||||
->whereVisibility('public')
|
->whereNull('reblog_of_id')
|
||||||
->whereNotIn('profile_id', $following)
|
->whereIsNsfw(false)
|
||||||
->withCount(['comments', 'likes'])
|
->whereVisibility('public')
|
||||||
->orderBy('created_at', 'desc')
|
->whereNotIn('profile_id', $following)
|
||||||
->take(21)
|
->withCount(['comments', 'likes'])
|
||||||
->get();
|
->orderBy('created_at', 'desc')
|
||||||
|
->take(21)
|
||||||
|
->get();
|
||||||
|
});
|
||||||
|
|
||||||
$res = [
|
$res = [
|
||||||
'people' => $people->map(function($profile) {
|
'people' => $people->map(function($profile) {
|
||||||
|
|
Loading…
Reference in a new issue