Refactored ban system
Implemented a Reddit-like account suspension system (similar to subreddit bans). This makes it easier to ban users from the app, and the code has also been cleaned up. The interface was also revamped.
This commit is contained in:
@@ -411,14 +411,13 @@ return [
|
||||
'title' => ':name\'s profile',
|
||||
'profile' => 'Profile',
|
||||
'users' => 'Users',
|
||||
'account_banned' => 'Account banned',
|
||||
'account_banned_exp' => 'This user has been banned by the moderators.',
|
||||
'ban_confirm' => 'Please confirm that you want to ban this user account. You\'ll need to add a reason and expiration date to confirm this. Bans don\'t transfer to connected Minecraft networks (yet).',
|
||||
'leave_empty' => 'Leave empty for a permanent ban',
|
||||
'account_banned' => 'Account suspended',
|
||||
'account_banned_exp' => 'This user has been suspended by the admins.',
|
||||
'ban_confirm' => 'Please confirm that you want to suspend this account. You\'ll need to add a reason and expiration date to confirm this.',
|
||||
'duration' => 'Duration',
|
||||
'p_duration' => 'Punishment duration',
|
||||
'p_duration' => 'Suspension duration',
|
||||
'p_duration_exp' => 'e.g. Spamming',
|
||||
'ban' => 'Ban',
|
||||
'ban' => 'Suspend',
|
||||
|
||||
'terminate_notice' => 'You are about to terminate a staff member',
|
||||
'terminate_notice_warning' => 'Terminating a staff member will remove their privileges on the team management site and Network.
|
||||
|
@@ -18,16 +18,16 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
@if ($profile->user->isBanned())
|
||||
@if (is_array($suspensionInfo))
|
||||
|
||||
<div class="alert alert-danger">
|
||||
|
||||
<span><i class="fa fa-ban"></i> <b>{{__('messages.profile.account_banned')}}</b></span>
|
||||
<span><i class="fa fa-ban"></i> <b>{{__('messages.profile.account_banned')}} {{ ($suspensionInfo['isPermanent']) ? __('permanently.') : __('until :date.', ['date' => $suspensionInfo['bannedUntil']]) }}</b></span>
|
||||
|
||||
<p>{{__('messages.profile.account_banned_exp')}}</p>
|
||||
|
||||
<p>
|
||||
<i class="fas fa-chevron-right"></i> <b>{{$profile->user->bans->reason}}</>
|
||||
<i class="fas fa-chevron-right"></i> <b>{{$suspensionInfo['reason']}}</b>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
@@ -43,32 +43,33 @@
|
||||
<form id="banAccountForm" name="banAccount" method="POST" action="{{route('banUser', ['user' => $profile->user->id])}}">
|
||||
@csrf
|
||||
|
||||
<label for="reason">{{__('messages.reusable.reason')}}</label>
|
||||
<input type="text" name="reason" id="reason" class="form-control" placeholder="{{__('messages.profile.p_duration_exp')}}">
|
||||
<div class="row">
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="durationOperator" aria-label="{{__('messages.profile.p_duration')}}">
|
||||
<div class="input-group-append">
|
||||
<button id="durationDropdown" class="btn btn-outline-secondary dropdown-toggle duration-btn" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{__('messages.profile.duration')}}</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#">Days</a>
|
||||
<a class="dropdown-item" href="#">Weeks</a>
|
||||
<a class="dropdown-item" href="#">Months</a>
|
||||
<div role="separator" class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#">Years</a>
|
||||
<div class="col">
|
||||
<label for="reason">{{__('Public note')}}</label>
|
||||
<input type="text" name="reason" id="reason" class="form-control" placeholder="{{__('messages.profile.p_duration_exp')}}">
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<label for="duration">{{ __('Duration') }}</label>
|
||||
<input type="text" name="duration" id="duration" class="form-control" placeholder="{{ __('in days') }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-muted text-sm">{{__('messages.profile.leave_empty')}}</p>
|
||||
|
||||
<input id="operator" type="hidden" value="" name="durationOperand" class="duration-operator-fld">
|
||||
|
||||
<div class="mt-2">
|
||||
<input type="hidden" name="suspensionType" value="off">
|
||||
|
||||
<label for="suspensionType">Suspension type</label><br>
|
||||
<input type="checkbox" id="suspensionType" name="suspensionType" checked data-toggle="toggle" data-on="Temporary" data-off="Permanent" data-onstyle="success" data-offstyle="danger" data-width="130" data-height="40">
|
||||
<p class="text-muted text-sm"><i class="fas fa-info-circle"></i> {{ __('Temporary suspensions will be automatically lifted. The suspension note is visible to all users. Suspended users will not be able to login or register.') }}</p>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<x-slot name="modalFooter">
|
||||
|
||||
<button id="banAccountButton" type="button" class="btn btn-danger"><i class="fa fa-ban"></i> {{__('messages.profile.ban')}}</button>
|
||||
|
||||
<button id="banAccountButton" type="button" class="btn btn-danger"><i class="fa fa-gavel"></i> {{__('Confirm')}}</button>
|
||||
</x-slot>
|
||||
|
||||
</x-modal>
|
||||
@@ -334,13 +335,13 @@
|
||||
<div class="management-btn text-center">
|
||||
|
||||
@if (!$profile->user->isBanned())
|
||||
<button class="btn btn-danger mb-2" id="banAccountTrigger"><i class="fa fa-ban"></i> {{__('messages.profile.ban_acc')}}</button><br>
|
||||
<button class="btn btn-danger mb-2" id="banAccountTrigger"><i class="fa fa-ban"></i> {{__('Suspend')}}</button><br>
|
||||
@else
|
||||
<form method="post" action="{{route('unbanUser', ['user' => $profile->user->id])}}">
|
||||
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-warning mb-2"><i class="fa fa-check"></i> {{__('messages.profile.unban_acc')}}</button>
|
||||
<button type="submit" class="btn btn-warning mb-2"><i class="fa fa-check"></i> {{__('Lift Suspension')}}</button>
|
||||
|
||||
</form>
|
||||
@endif
|
||||
|
Reference in New Issue
Block a user