mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-27 00:33:17 +00:00
Merge pull request #1314 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
40ecbb5e6b
2 changed files with 3 additions and 60 deletions
|
@ -63,17 +63,6 @@ class InternalApiController extends Controller
|
||||||
});
|
});
|
||||||
$following = array_merge($following, $filters);
|
$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')
|
$posts = Status::select('id', 'caption', 'profile_id')
|
||||||
->whereHas('media')
|
->whereHas('media')
|
||||||
->whereIsNsfw(false)
|
->whereIsNsfw(false)
|
||||||
|
@ -85,15 +74,6 @@ class InternalApiController extends Controller
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$res = [
|
$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) {
|
'posts' => $posts->map(function($post) {
|
||||||
return [
|
return [
|
||||||
'url' => $post->url(),
|
'url' => $post->url(),
|
||||||
|
@ -104,45 +84,6 @@ class InternalApiController extends Controller
|
||||||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
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)
|
public function discoverPosts(Request $request)
|
||||||
{
|
{
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
|
|
|
@ -88,11 +88,13 @@
|
||||||
<span class="text-muted notification-timestamp pl-1">{{$notification->created_at->diffForHumans(null, true, true, true)}}</span>
|
<span class="text-muted notification-timestamp pl-1">{{$notification->created_at->diffForHumans(null, true, true, true)}}</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="float-right notification-action">
|
<span class="float-right notification-action">
|
||||||
@if(false == true && $notification->item_id && $notification->item_type == 'App\Status')
|
@if($notification->item_id && $notification->item_type == 'App\Status')
|
||||||
|
@if($notification->status->parent())
|
||||||
<a href="{{$notification->status->parent()->url()}}">
|
<a href="{{$notification->status->parent()->url()}}">
|
||||||
<div class="notification-image" style="background-image: url('{{$notification->status->parent()->thumb()}}')"></div>
|
<div class="notification-image" style="background-image: url('{{$notification->status->parent()->thumb()}}')"></div>
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
|
@endif
|
||||||
</span>
|
</span>
|
||||||
@break
|
@break
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue