Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesigned Admin Dashboard Reports/Moderation
- Loading branch information
Showing
8 changed files
with
1,651 additions
and
94 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace App\Http\Resources; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Resources\Json\JsonResource; | ||
use App\Services\AccountService; | ||
use App\Services\StatusService; | ||
|
||
class AdminReport extends JsonResource | ||
{ | ||
/** | ||
* Transform the resource into an array. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function toArray(Request $request): array | ||
{ | ||
$res = [ | ||
'id' => $this->id, | ||
'reporter' => AccountService::get($this->profile_id, true), | ||
'type' => $this->type, | ||
'object_id' => (string) $this->object_id, | ||
'object_type' => $this->object_type, | ||
'reported' => AccountService::get($this->reported_profile_id, true), | ||
'status' => null, | ||
'reporter_message' => $this->message, | ||
'admin_seen_at' => $this->admin_seen, | ||
'created_at' => $this->created_at, | ||
]; | ||
|
||
if($this->object_id && $this->object_type === 'App\Status') { | ||
$res['status'] = StatusService::get($this->object_id, false); | ||
} | ||
|
||
return $res; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App\Http\Resources; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Resources\Json\JsonResource; | ||
use App\Services\AccountService; | ||
use App\Services\StatusService; | ||
|
||
class AdminSpamReport extends JsonResource | ||
{ | ||
/** | ||
* Transform the resource into an array. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function toArray(Request $request): array | ||
{ | ||
$res = [ | ||
'id' => $this->id, | ||
'type' => $this->type, | ||
'status' => null, | ||
'read_at' => $this->read_at, | ||
'created_at' => $this->created_at, | ||
]; | ||
|
||
if($this->item_id && $this->item_type === 'App\Status') { | ||
$res['status'] = StatusService::get($this->item_id, false); | ||
} | ||
|
||
return $res; | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,12 @@ | ||
@extends('admin.partial.template-full') | ||
|
||
@section('section') | ||
<div class="title mb-3 d-flex justify-content-between align-items-center"> | ||
<h3 class="font-weight-bold d-inline-block">Reports</h3> | ||
<div class="float-right"> | ||
@if(request()->has('filter') && request()->filter == 'closed') | ||
<a class="mr-3 font-weight-light small text-muted" href="{{route('admin.reports')}}"> | ||
View Open Reports | ||
</a> | ||
@else | ||
<a class="mr-3 font-weight-light small text-muted" href="{{route('admin.reports',['filter'=>'closed'])}}"> | ||
View Closed Reports | ||
</a> | ||
@endif | ||
</div> | ||
</div> | ||
|
||
<div class="col-12 col-md-8 offset-md-2"> | ||
<div class="mb-4"> | ||
<a class="btn btn-outline-primary px-5 py-3 mr-3" href="/i/admin/reports/email-verifications"> | ||
<p class="font-weight-bold h4 mb-0">{{$mailVerifications}}</p> | ||
Email Verify {{$mailVerifications == 1 ? 'Request' : 'Requests'}} | ||
</a> | ||
<a class="btn btn-outline-primary px-5 py-3 mr-3" href="/i/admin/reports/appeals"> | ||
<p class="font-weight-bold h4 mb-0">{{$ai}}</p> | ||
Appeal {{$ai == 1 ? 'Request' : 'Requests'}} | ||
</a> | ||
<a class="btn btn-outline-primary px-5 py-3" href="/i/admin/reports/autospam"> | ||
<p class="font-weight-bold h4 mb-0">{{$spam}}</p> | ||
Flagged {{$ai == 1 ? 'Post' : 'Posts'}} | ||
</a> | ||
</div> | ||
</div> | ||
@if($reports->count()) | ||
<div class="col-12 col-md-8 offset-md-2"> | ||
<div class="card shadow-none border"> | ||
<div class="list-group list-group-flush"> | ||
@foreach($reports as $report) | ||
<div class="list-group-item p-1 {{$report->admin_seen ? 'bg-light' : 'bg-white'}}"> | ||
<div class="p-0"> | ||
<div class="media d-flex align-items-center"> | ||
<a class="text-decoration-none" href="{{$report->url()}}"> | ||
<img src="{{$report->status->media && $report->status->media->count() ? $report->status->thumb(true) : '/storage/no-preview.png'}}" width="64" height="64" class="rounded border shadow mr-3" style="object-fit: cover"> | ||
</a> | ||
<div class="media-body"> | ||
<p class="mb-1 small"><span class="font-weight-bold text-uppercase text-danger">{{$report->type}}</span></p> | ||
@if($report->reporter && $report->status) | ||
<p class="mb-0"><a class="font-weight-bold text-dark" href="{{$report->reporter->url()}}">{{$report->reporter->username}}</a> reported this <a href="{{$report->status->url()}}" class="font-weight-bold text-dark">post</a></p> | ||
@else | ||
<p class="mb-0 lead"> | ||
@if(!$report->reporter) | ||
<span class="font-weight-bold text-dark">Deleted user</span> | ||
@else | ||
<a class="font-weight-bold text-dark" href="{{$report->reporter->url()}}">{{$report->reporter->username}}</a> | ||
@endif | ||
reported this | ||
@if(!$report->status) | ||
<span class="font-weight-bold text-muted">deleted post</span> | ||
@else | ||
<a href="{{$report->status->url()}}" class="font-weight-bold text-dark">post</a> | ||
@endif | ||
|
||
</p> | ||
|
||
@endif | ||
</div> | ||
<div class="float-right"> | ||
@if($report->status) | ||
<a class="text-lighter p-2 text-decoration-none" href="{{$report->url()}}"> | ||
View <i class="fas fa-chevron-right ml-2"></i> | ||
</a> | ||
@endif | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
@endforeach | ||
</div> | ||
</div> | ||
</div> | ||
@else | ||
<div class="card shadow-none border"> | ||
<div class="card-body"> | ||
<p class="mb-0 p-5 text-center font-weight-bold lead">No reports found</p> | ||
</div> | ||
</div> | ||
@endif | ||
|
||
<div class="d-flex justify-content-center mt-5 small"> | ||
{{$reports->appends(['layout'=>request()->layout, 'filter' => request()->filter])->links()}} | ||
</div> | ||
</div> | ||
<admin-reports /> | ||
@endsection | ||
|
||
@push('scripts') | ||
<script type="text/javascript"> | ||
new Vue({ el: '#panel'}); | ||
</script> | ||
@endpush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters