mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-20 12:03:16 +00:00
Merge pull request #4462 from pixelfed/staging
Update admin dashboard, improve users section
This commit is contained in:
commit
7736324ee7
3 changed files with 83 additions and 5 deletions
|
@ -7,6 +7,7 @@
|
|||
- Update Direct Messages, fix api endpoint ([fe8728c0](https://github.com/pixelfed/pixelfed/commit/fe8728c0))
|
||||
- Update nginx config ([fbdc6358](https://github.com/pixelfed/pixelfed/commit/fbdc6358))
|
||||
- Update api routes, add DeprecatedEndpoint middleware. For more info, visit [pixelfed.org/kb/10404](https://pixelfed.org/kb/10404) ([a8453e77](https://github.com/pixelfed/pixelfed/commit/a8453e77))
|
||||
- Update admin dashboard, improve users section ([36b6bf48](https://github.com/pixelfed/pixelfed/commit/36b6bf48))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
|
||||
## [v0.11.8 (2023-05-29)](https://github.com/pixelfed/pixelfed/compare/v0.11.7...v0.11.8)
|
||||
|
|
|
@ -11,6 +11,7 @@ use App\Mail\AdminMessage;
|
|||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Services\ModLogService;
|
||||
use App\Jobs\DeletePipeline\DeleteAccountPipeline;
|
||||
use App\Services\AccountService;
|
||||
|
||||
trait AdminUserController
|
||||
{
|
||||
|
@ -25,7 +26,7 @@ trait AdminUserController
|
|||
'next' => $offset + 1,
|
||||
'query' => $search ? '&a=search&q=' . $search : null
|
||||
];
|
||||
$users = User::select('id', 'username', 'status', 'profile_id')
|
||||
$users = User::select('id', 'username', 'status', 'profile_id', 'is_admin')
|
||||
->orderBy($col, $dir)
|
||||
->when($search, function($q, $search) {
|
||||
return $q->where('username', 'like', "%{$search}%");
|
||||
|
@ -34,7 +35,11 @@ trait AdminUserController
|
|||
return $q->offset(($offset * 10));
|
||||
})
|
||||
->limit(10)
|
||||
->get();
|
||||
->get()
|
||||
->map(function($u) {
|
||||
$u['account'] = AccountService::get($u->profile_id, true);
|
||||
return $u;
|
||||
});
|
||||
|
||||
return view('admin.users.home', compact('users', 'pagination'));
|
||||
}
|
||||
|
|
|
@ -20,29 +20,51 @@
|
|||
<table class="table">
|
||||
<thead class="bg-light">
|
||||
<tr class="text-center">
|
||||
{{-- <th scope="col" class="border-0" width="5%">
|
||||
</th> --}}
|
||||
<th scope="col" class="border-0" width="10%">
|
||||
<span>ID</span>
|
||||
</th>
|
||||
<th scope="col" class="border-0" width="30%">
|
||||
<th scope="col" class="border-0" width="40%">
|
||||
<span>Username</span>
|
||||
</th>
|
||||
<th scope="col" class="border-0" width="5%">
|
||||
<span>Status<br/>Count</span>
|
||||
</th>
|
||||
<th scope="col" class="border-0" width="5%">
|
||||
<span>Followers<br/>Count</span>
|
||||
</th>
|
||||
<th scope="col" class="border-0" width="5%">
|
||||
<span>Following<br/>Count</span>
|
||||
</th>
|
||||
<th scope="col" class="border-0" width="30%">
|
||||
<span>Actions</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($users as $user)
|
||||
@foreach($users as $key => $user)
|
||||
@if($user->status == 'deleted')
|
||||
<tr class="font-weight-bold text-center user-row">
|
||||
{{-- <th scope="row">
|
||||
<div class="custom-control custom-checkbox account-select-check">
|
||||
<input type="checkbox" class="custom-control-input" disabled>
|
||||
<label class="custom-control-label"></label>
|
||||
</div>
|
||||
</th> --}}
|
||||
<th scope="row">
|
||||
<span class="text-danger" class="text-monospace">{{$user->id}}</span>
|
||||
</th>
|
||||
<td class="text-left">
|
||||
<img src="/storage/avatars/default.jpg" width="20" height="20" class="rounded-circle mr-1" />
|
||||
|
||||
<span title="{{$user->username}}" data-toggle="tooltip" data-placement="bottom">
|
||||
<span class="text-danger">{{$user->username}}</span>
|
||||
</span>
|
||||
</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>0</td>
|
||||
<td>
|
||||
<span class="font-weight-bold small">
|
||||
<span class="text-danger">Account Deleted</span>
|
||||
|
@ -51,10 +73,19 @@
|
|||
</tr>
|
||||
@else
|
||||
<tr class="font-weight-bold text-center user-row">
|
||||
{{-- <th scope="row">
|
||||
<div class="custom-control custom-checkbox account-select-check">
|
||||
<input type="checkbox" id="{{$key}}" class="custom-control-input">
|
||||
<label class="custom-control-label" for={{$key}}></label>
|
||||
</div>
|
||||
</th> --}}
|
||||
<th scope="row">
|
||||
<span class="text-monospace">{{$user->id}}</span>
|
||||
</th>
|
||||
<td class="text-left">
|
||||
<td class="text-left d-flex align-items-center">
|
||||
@if($user->account)
|
||||
<img src="{{$user->account['avatar']}}" width="20" height="20" class="rounded-circle mr-2" />
|
||||
@endif
|
||||
<span title="{{$user->username}}" data-toggle="tooltip" data-placement="bottom">
|
||||
<span>{{$user->username}}</span>
|
||||
@if($user->is_admin)
|
||||
|
@ -62,6 +93,27 @@
|
|||
@endif
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
@if($user->account)
|
||||
{{$user->account['statuses_count']}}
|
||||
@else
|
||||
0
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($user->account)
|
||||
{{$user->account['followers_count']}}
|
||||
@else
|
||||
0
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($user->account)
|
||||
{{$user->account['following_count']}}
|
||||
@else
|
||||
0
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<span class="action-row font-weight-lighter">
|
||||
<a href="/{{$user->username}}" class="pr-2 text-muted small font-weight-bold" title="View Profile" data-toggle="tooltip" data-placement="bottom">
|
||||
|
@ -75,6 +127,11 @@
|
|||
<a href="/i/admin/users/modtools/{{$user->id}}" class="pr-2 text-muted small font-weight-bold" title="Moderation Logs" data-toggle="tooltip" data-placement="bottom">
|
||||
Mod Tools
|
||||
</a>
|
||||
@if($user->status !== 'deleted' && !$user->is_admin)
|
||||
<a href="/i/admin/users/delete/{{$user->id}}" class="pr-2 text-muted small font-weight-bold" title="Delete account" data-toggle="tooltip" data-placement="bottom" onclick="deleteAccount({{$user->id}})">
|
||||
Delete
|
||||
</a>
|
||||
@endif
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -117,5 +174,20 @@
|
|||
el.text(filesize(size, {round: 0}));
|
||||
});
|
||||
});
|
||||
|
||||
function deleteAccount(id) {
|
||||
event.preventDefault();
|
||||
if(!window.confirm('Are you sure you want to delete this account?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
axios.post('/i/admin/users/delete/' + id)
|
||||
.then(res => {
|
||||
swal('Account Deleted', 'Successfully deleted this account! This page will refresh once you press OK.', 'success')
|
||||
.then(res => {
|
||||
window.location.reload();
|
||||
});
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
|
|
Loading…
Reference in a new issue