diff --git a/app/Http/Controllers/Admin/AdminUserController.php b/app/Http/Controllers/Admin/AdminUserController.php index 8cefa79ee..227ff53ea 100644 --- a/app/Http/Controllers/Admin/AdminUserController.php +++ b/app/Http/Controllers/Admin/AdminUserController.php @@ -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); } } \ No newline at end of file diff --git a/resources/views/admin/users/modtools.blade.php b/resources/views/admin/users/modtools.blade.php index befa3e38c..76919302e 100644 --- a/resources/views/admin/users/modtools.blade.php +++ b/resources/views/admin/users/modtools.blade.php @@ -54,53 +54,36 @@
- {{$profile->name}} -
- @if($user->is_admin == true) -- ADMIN -
- @endif -- Joined {{$profile->created_at->diffForHumans()}} -
-bookmarks | -{{$profile->bookmarks()->count()}} | -
---|---|
collections | -{{$profile->collections()->count()}} | -
likes | -{{$profile->likes()->count()}} | -
reports | -{{$profile->reports()->count()}} | -
reported | -{{$profile->reported()->count()}} | -
Active stories | -{{$profile->stories()->count()}} | -
storage used | -{{PrettyNumber::size($profile->media()->sum('size'))}} / {{PrettyNumber::size(config('pixelfed.max_account_size') * 1000)}} | -
Recent Posts
-No statuses found
-+ {{$profile->name}} +
+ @if($user->is_admin == true) ++ ADMIN +
@endif ++ Joined {{$profile->created_at->diffForHumans()}} +
bookmarks | +{{$profile->bookmarks()->count()}} | +
---|---|
collections | +{{$profile->collections()->count()}} | +
likes | +{{$profile->likes()->count()}} | +
reports | +{{$profile->reports()->count()}} | +
reported | +{{$profile->reported()->count()}} | +
Active stories | +{{$profile->stories()->count()}} | +
storage used | +{{PrettyNumber::size($profile->media()->sum('size'))}} / {{PrettyNumber::size(config('pixelfed.max_account_size') * 1000)}} | +
Recent Posts
+No statuses found
+