mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-24 14:03:16 +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');
|
||||
$profile = Profile::findOrFail($pid);
|
||||
|
||||
if($profile->user->is_admin == true) {
|
||||
$mid = $request->user()->id;
|
||||
abort_if($profile->user_id < $mid, 403);
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'cw':
|
||||
$profile->cw = true;
|
||||
$msg = "Successfully added Content Warnings to {$profile->username}'s future posts!";
|
||||
$profile->cw = !$profile->cw;
|
||||
$msg = "Success!";
|
||||
break;
|
||||
|
||||
case 'no_autolink':
|
||||
$profile->no_autolink = true;
|
||||
$msg = "Successfully applied No Autolinking to {$profile->username}'s future posts!";
|
||||
$profile->no_autolink = !$profile->no_autolink;
|
||||
$msg = "Success!";
|
||||
break;
|
||||
|
||||
case 'unlisted':
|
||||
$profile->unlisted = true;
|
||||
$msg = "Successfully applied Unlisted scope to {$profile->username}'s future posts!";
|
||||
$profile->unlisted = !$profile->unlisted;
|
||||
$msg = "Success!";
|
||||
break;
|
||||
}
|
||||
|
||||
$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);
|
||||
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">
|
||||
<form method="post" action="/i/admin/users/moderation/update" class="pb-3">
|
||||
@csrf
|
||||
<input type="hidden" name="action" value="cw">
|
||||
<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>
|
||||
</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="action" value="unlisted">
|
||||
<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>
|
||||
</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="action" value="no_autolink">
|
||||
<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>
|
||||
</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">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>
|
||||
|
|
|
@ -42,10 +42,10 @@
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="row mb-3">
|
||||
</span>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 col-md-4">
|
||||
<div class="card shadow-none border">
|
||||
<div class="card-body text-center">
|
||||
|
@ -117,5 +117,5 @@
|
|||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
</div>
|
||||
@endsection
|
Loading…
Reference in a new issue