mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update admin modlogs
This commit is contained in:
parent
e07bd934ac
commit
77778d3e41
4 changed files with 56 additions and 13 deletions
|
@ -267,4 +267,18 @@ trait AdminUserController
|
|||
$request->session()->flash('status', $msg);
|
||||
return redirect('/i/admin/users/modtools/' . $profile->user_id);
|
||||
}
|
||||
|
||||
public function userModLogDelete(Request $request, $id)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'mid' => 'required|integer|exists:mod_logs,id'
|
||||
]);
|
||||
$user = User::findOrFail($id);
|
||||
$uid = $request->user()->id;
|
||||
$mid = $request->input('mid');
|
||||
$ml = ModLog::whereUserId($uid)->findOrFail($mid)->delete();
|
||||
$msg = "Successfully deleted modlog comment!";
|
||||
$request->session()->flash('status', $msg);
|
||||
return redirect('/i/admin/users/modlogs/' . $user->id);
|
||||
}
|
||||
}
|
|
@ -18,14 +18,26 @@ class ModLog extends Model
|
|||
$msg = 'Unknown action';
|
||||
|
||||
switch ($this->action) {
|
||||
case 'admin.user.message':
|
||||
$msg = "Sent Email Message";
|
||||
case 'admin.user.mail':
|
||||
$msg = "Sent Message";
|
||||
break;
|
||||
|
||||
case 'admin.user.action.cw.warn':
|
||||
$msg = "Sent CW reminder";
|
||||
break;
|
||||
|
||||
case 'admin.user.edit':
|
||||
$msg = "Changed Profile";
|
||||
break;
|
||||
|
||||
case 'admin.user.moderate':
|
||||
$msg = "Moderation";
|
||||
break;
|
||||
|
||||
case 'admin.user.delete':
|
||||
$msg = "Deleted Account";
|
||||
break;
|
||||
|
||||
default:
|
||||
$msg = 'Unknown action';
|
||||
break;
|
||||
|
|
|
@ -78,13 +78,13 @@
|
|||
@if($logs->count() > 0)
|
||||
<div class="list-group">
|
||||
@foreach($logs as $log)
|
||||
<div class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<div class="list-group-item">
|
||||
@if($log->message != null)
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="mr-3">
|
||||
<img src="{{$log->admin->profile->avatarUrl()}}" width="40px" height="40px" class="border p-1 rounded-circle">
|
||||
</div>
|
||||
<div style="min-width: 400px;">
|
||||
<div style="flex-grow: 1;">
|
||||
@if($log->user_id != Auth::id())
|
||||
<div class="p-3 bg-primary rounded">
|
||||
<p class="mb-0 text-white" style="font-weight: 500;">{{$log->message}}</p>
|
||||
|
@ -103,9 +103,24 @@
|
|||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@if($log->user_id == Auth::id())
|
||||
<div class="align-self-top ml-2">
|
||||
<form method="post" action="/i/admin/users/modlogs/{{$user->id}}/delete">
|
||||
@csrf
|
||||
<input type="hidden" name="mid" value="{{$log->id}}">
|
||||
<button type="submit" class="btn btn-text">
|
||||
<i class="fas fa-times text-lighter"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<div>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="mr-3">
|
||||
<img src="{{$log->admin->profile->avatarUrl()}}" width="40px" height="40px" class="border p-1 rounded-circle">
|
||||
</div>
|
||||
<div style="flex-grow: 1;">
|
||||
<p class="small text-muted font-weight-bold mb-0">{{$log->created_at->diffForHumans()}}</p>
|
||||
<p class="lead mb-0">{{$log->actionToText()}}</p>
|
||||
<p class="small text-muted font-weight-bold mb-0">
|
||||
|
@ -115,6 +130,7 @@
|
|||
<div>
|
||||
<i class="fas fa-chevron-right fa-lg text-lighter"></i>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
|
|
|
@ -25,6 +25,7 @@ Route::domain(config('pixelfed.domain.admin'))->prefix('i/admin')->group(functio
|
|||
Route::get('users/modtools/{id}', 'AdminController@userModTools');
|
||||
Route::get('users/modlogs/{id}', 'AdminController@userModLogs');
|
||||
Route::post('users/modlogs/{id}', 'AdminController@userModLogsMessage');
|
||||
Route::post('users/modlogs/{id}/delete', 'AdminController@userModLogDelete');
|
||||
Route::get('users/delete/{id}', 'AdminController@userDelete');
|
||||
Route::post('users/delete/{id}', 'AdminController@userDeleteProcess');
|
||||
Route::post('users/moderation/update', 'AdminController@userModerate');
|
||||
|
|
Loading…
Reference in a new issue