mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 06:23:18 +00:00
Update AdminUserController modtools
This commit is contained in:
parent
a4cf21eaad
commit
a7adfb9457
3 changed files with 112 additions and 110 deletions
|
@ -168,25 +168,44 @@ trait AdminUserController
|
||||||
$action = $request->input('action');
|
$action = $request->input('action');
|
||||||
$profile = Profile::findOrFail($pid);
|
$profile = Profile::findOrFail($pid);
|
||||||
|
|
||||||
|
if($profile->user->is_admin == true) {
|
||||||
|
$mid = $request->user()->id;
|
||||||
|
abort_if($profile->user_id < $mid, 403);
|
||||||
|
}
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'cw':
|
case 'cw':
|
||||||
$profile->cw = true;
|
$profile->cw = !$profile->cw;
|
||||||
$msg = "Successfully added Content Warnings to {$profile->username}'s future posts!";
|
$msg = "Success!";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'no_autolink':
|
case 'no_autolink':
|
||||||
$profile->no_autolink = true;
|
$profile->no_autolink = !$profile->no_autolink;
|
||||||
$msg = "Successfully applied No Autolinking to {$profile->username}'s future posts!";
|
$msg = "Success!";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'unlisted':
|
case 'unlisted':
|
||||||
$profile->unlisted = true;
|
$profile->unlisted = !$profile->unlisted;
|
||||||
$msg = "Successfully applied Unlisted scope to {$profile->username}'s future posts!";
|
$msg = "Success!";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile->save();
|
$profile->save();
|
||||||
|
|
||||||
|
ModLogService::boot()
|
||||||
|
->objectUid($profile->user_id)
|
||||||
|
->objectId($profile->user_id)
|
||||||
|
->objectType('App\User::class')
|
||||||
|
->user($request->user())
|
||||||
|
->action('admin.user.moderate')
|
||||||
|
->metadata([
|
||||||
|
'action' => $action,
|
||||||
|
'message' => $msg
|
||||||
|
])
|
||||||
|
->accessLevel('admin')
|
||||||
|
->save();
|
||||||
|
|
||||||
$request->session()->flash('status', $msg);
|
$request->session()->flash('status', $msg);
|
||||||
return redirect('/i/admin/users/show/' . $profile->user_id);
|
return redirect('/i/admin/users/modtools/' . $profile->user_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -54,53 +54,36 @@
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
||||||
@csrf
|
@csrf
|
||||||
|
<input type="hidden" name="action" value="cw">
|
||||||
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
||||||
<button class="btn btn-outline-primary py-0 font-weight-bold">Enforce CW</button>
|
<button class="btn btn-outline-{{$profile->cw ? 'secondary' : 'primary'}} py-0 font-weight-bold">
|
||||||
|
{{$profile->cw ? 'Remove CW Enforcement' : 'Enforce CW'}}
|
||||||
|
</button>
|
||||||
<p class="help-text text-muted font-weight-bold small">Adds a CW to every post made by this account.</p>
|
<p class="help-text text-muted font-weight-bold small">Adds a CW to every post made by this account.</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
||||||
@csrf
|
@csrf
|
||||||
|
<input type="hidden" name="action" value="unlisted">
|
||||||
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
||||||
<button class="btn btn-outline-primary py-0 font-weight-bold">Unlisted Posts</button>
|
<button class="btn btn-outline-{{$profile->unlisted ? 'secondary' : 'primary'}} py-0 font-weight-bold">
|
||||||
|
{{$profile->unlisted ? 'Remove Unlisting' : 'Unlisted Posts'}}
|
||||||
|
</button>
|
||||||
<p class="help-text text-muted font-weight-bold small">Removes account from public/network timelines.</p>
|
<p class="help-text text-muted font-weight-bold small">Removes account from public/network timelines.</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
<div class="col-12 col-md-6">
|
||||||
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
||||||
@csrf
|
@csrf
|
||||||
|
<input type="hidden" name="action" value="no_autolink">
|
||||||
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
||||||
<button class="btn btn-outline-primary py-0 font-weight-bold">No Autolinking</button>
|
<button class="btn btn-outline-{{$profile->no_autolink ? 'secondary' : 'primary'}} py-0 font-weight-bold">
|
||||||
|
{{$profile->no_autolink ? 'Remove No Autolinking' : 'No Autolinking'}}
|
||||||
|
</button>
|
||||||
<p class="help-text text-muted font-weight-bold small">Do not transform mentions, hashtags or urls into HTML.</p>
|
<p class="help-text text-muted font-weight-bold small">Do not transform mentions, hashtags or urls into HTML.</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-6">
|
|
||||||
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
|
||||||
@csrf
|
|
||||||
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
|
||||||
<button class="btn btn-outline-primary py-0 font-weight-bold">Disable Account</button>
|
|
||||||
<p class="help-text text-muted font-weight-bold small">Temporarily disable account until next time user log in.</p>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12 col-md-6">
|
|
||||||
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
|
||||||
@csrf
|
|
||||||
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
|
||||||
<button class="btn btn-outline-primary py-0 font-weight-bold">Suspend Account</button>
|
|
||||||
<p class="help-text text-muted font-weight-bold small">This prevents any new interactions, without deleting existing data.</p>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-12 col-md-6">
|
|
||||||
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
|
||||||
@csrf
|
|
||||||
<input type="hidden" name="profile_id" value="{{$profile->id}}">
|
|
||||||
<button class="btn btn-outline-danger py-0 font-weight-bold">Lock down Account</button>
|
|
||||||
<p class="help-text text-muted font-weight-bold small">This disables the account and changes the password, forcing account to reset password via verified email.</p>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -42,80 +42,80 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</span>
|
||||||
<hr>
|
</div>
|
||||||
|
<hr>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-12 col-md-4">
|
<div class="col-12 col-md-4">
|
||||||
<div class="card shadow-none border">
|
<div class="card shadow-none border">
|
||||||
<div class="card-body text-center">
|
<div class="card-body text-center">
|
||||||
<img src="{{$profile->avatarUrl()}}" class="box-shadow rounded-circle" width="128px" height="128px">
|
<img src="{{$profile->avatarUrl()}}" class="box-shadow rounded-circle" width="128px" height="128px">
|
||||||
<p class="mt-3 mb-0 lead">
|
<p class="mt-3 mb-0 lead">
|
||||||
<span class="font-weight-bold">{{$profile->name}}</span>
|
<span class="font-weight-bold">{{$profile->name}}</span>
|
||||||
</p>
|
</p>
|
||||||
@if($user->is_admin == true)
|
@if($user->is_admin == true)
|
||||||
<p class="mb-0">
|
<p class="mb-0">
|
||||||
<span class="badge badge-danger badge-sm">ADMIN</span>
|
<span class="badge badge-danger badge-sm">ADMIN</span>
|
||||||
</p>
|
</p>
|
||||||
@endif
|
|
||||||
<p class="mb-0 text-center text-muted">
|
|
||||||
Joined {{$profile->created_at->diffForHumans()}}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<table class="table mb-0">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">bookmarks</th>
|
|
||||||
<td class="text-right font-weight-bold">{{$profile->bookmarks()->count()}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">collections</th>
|
|
||||||
<td class="text-right font-weight-bold">{{$profile->collections()->count()}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">likes</th>
|
|
||||||
<td class="text-right font-weight-bold">{{$profile->likes()->count()}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">reports</th>
|
|
||||||
<td class="text-right font-weight-bold">{{$profile->reports()->count()}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">reported</th>
|
|
||||||
<td class="text-right font-weight-bold">{{$profile->reported()->count()}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">Active stories</th>
|
|
||||||
<td class="text-right font-weight-bold">{{$profile->stories()->count()}}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">storage used</th>
|
|
||||||
<td class="text-right font-weight-bold">{{PrettyNumber::size($profile->media()->sum('size'))}}<span class="text-muted"> / {{PrettyNumber::size(config('pixelfed.max_account_size') * 1000)}}</span></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-12 col-md-8">
|
|
||||||
<p class="title h4 font-weight-bold mt-2 py-2">Recent Posts</p>
|
|
||||||
<hr>
|
|
||||||
<div class="row">
|
|
||||||
@foreach($profile->statuses()->whereHas('media')->latest()->take(9)->get() as $item)
|
|
||||||
<div class="col-12 col-md-4 col-sm-6 px-0" style="margin-bottom: 1px;">
|
|
||||||
<a href="{{$item->url()}}">
|
|
||||||
<img src="{{$item->thumb(true)}}" width="200px" height="200px">
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@if($profile->statuses()->whereHas('media')->count() == 0)
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card card-body border shadow-none bg-transparent">
|
|
||||||
<p class="text-center mb-0 text-muted">No statuses found</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
@endif
|
||||||
|
<p class="mb-0 text-center text-muted">
|
||||||
|
Joined {{$profile->created_at->diffForHumans()}}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<table class="table mb-0">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">bookmarks</th>
|
||||||
|
<td class="text-right font-weight-bold">{{$profile->bookmarks()->count()}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">collections</th>
|
||||||
|
<td class="text-right font-weight-bold">{{$profile->collections()->count()}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">likes</th>
|
||||||
|
<td class="text-right font-weight-bold">{{$profile->likes()->count()}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">reports</th>
|
||||||
|
<td class="text-right font-weight-bold">{{$profile->reports()->count()}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">reported</th>
|
||||||
|
<td class="text-right font-weight-bold">{{$profile->reported()->count()}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">Active stories</th>
|
||||||
|
<td class="text-right font-weight-bold">{{$profile->stories()->count()}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" class="font-weight-bold text-muted text-uppercase pl-3 small" style="line-height: 2;">storage used</th>
|
||||||
|
<td class="text-right font-weight-bold">{{PrettyNumber::size($profile->media()->sum('size'))}}<span class="text-muted"> / {{PrettyNumber::size(config('pixelfed.max_account_size') * 1000)}}</span></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
<div class="col-12 col-md-8">
|
||||||
|
<p class="title h4 font-weight-bold mt-2 py-2">Recent Posts</p>
|
||||||
|
<hr>
|
||||||
|
<div class="row">
|
||||||
|
@foreach($profile->statuses()->whereHas('media')->latest()->take(9)->get() as $item)
|
||||||
|
<div class="col-12 col-md-4 col-sm-6 px-0" style="margin-bottom: 1px;">
|
||||||
|
<a href="{{$item->url()}}">
|
||||||
|
<img src="{{$item->thumb(true)}}" width="200px" height="200px">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@if($profile->statuses()->whereHas('media')->count() == 0)
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card card-body border shadow-none bg-transparent">
|
||||||
|
<p class="text-center mb-0 text-muted">No statuses found</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
Loading…
Reference in a new issue