mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-24 12:09:02 -05:00
update: users online block cache and appearance
Make sure the cache caches based on the group since the privacy setting for showing up here can be based on the group. Also show the data in columns to look a little nicer.
This commit is contained in:
@@ -59,7 +59,7 @@ class HomeController extends Controller
|
||||
'user' => $user,
|
||||
'personal_freeleech' => cache()->get('personal_freeleech:'.$user->id),
|
||||
'users' => cache()->remember(
|
||||
'online_users',
|
||||
'online_users:by-group:'.auth()->user()->group_id,
|
||||
$expiresAt,
|
||||
fn () => User::with('group', 'privacy')
|
||||
->withCount([
|
||||
@@ -67,8 +67,10 @@ class HomeController extends Controller
|
||||
$query->whereNotNull('torrent')->where('active', '1');
|
||||
},
|
||||
])
|
||||
->where('last_action', '>', now()->subMinutes(5))
|
||||
->where('last_action', '>', now()->subDays(19))
|
||||
->orderByRaw('(select position from `groups` where `groups`.id = users.group_id), group_id, username')
|
||||
->get()
|
||||
->sortBy(fn ($user) => $user->hidden || ! $user->isVisible($user, 'other', 'show_online'))
|
||||
),
|
||||
'groups' => cache()->remember(
|
||||
'user-groups',
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{{ __('blocks.users-online') }} ({{ $users->count() }})
|
||||
</h2>
|
||||
<div class="panel__body">
|
||||
<ul style="display: flex; flex-wrap: wrap; column-gap: 1rem; list-style-type: none; padding: 0">
|
||||
<ul style="column-width: 200px; column-gap: 1rem; list-style-type: none; padding: 0">
|
||||
@foreach ($users as $user)
|
||||
<li>
|
||||
<x-user_tag :user="$user" :anon="$user->hidden || ! $user->isVisible($user, 'other', 'show_online')">
|
||||
@@ -21,9 +21,9 @@
|
||||
@endforeach
|
||||
</ul>
|
||||
<hr>
|
||||
<ul style="display: flex; flex-wrap: wrap; column-gap: 1rem; list-style-type: none; padding: 0; justify-content: center">
|
||||
<ul style="column-width: 200px; column-gap: 1rem; list-style-type: none; padding: 0;">
|
||||
@foreach ($groups as $group)
|
||||
<span class="user-tag" style="background-image: {{ $group->effect }};">
|
||||
<span class="user-tag" style="padding: 4px 8px; display: block">
|
||||
<a
|
||||
class="user-tag__link {{ $group->icon }}"
|
||||
href="{{ route('group', ['id' => $group->id]) }}"
|
||||
|
||||
Reference in New Issue
Block a user