Add appeal/interstitial views

This commit is contained in:
Daniel Supernault 2020-12-09 21:55:42 -07:00
parent 9bc7fd63c8
commit b8330b3d92
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
6 changed files with 554 additions and 0 deletions

View file

@ -0,0 +1,130 @@
@extends('layouts.blank')
@section('content')
<div class="container mt-5">
<div class="row">
<div class="col-12 col-md-6 offset-md-3 text-center">
<p class="h1 pb-2" style="font-weight: 200">Your Post Contains Sensitive or Offensive Material</p>
<p class="lead py-3">We applied a Content Warning to your post because it doesn't follow our <a class="font-weight-bold text-dark" href="{{route('help.community-guidelines')}}">Community Guidelines</a>.</p>
<p class="font-weight-bold alert alert-danger text-left">To continue you must click the "I Understand" button or "REQUEST APPEAL" button at the bottom of this page.</p>
</div>
<div class="col-12 col-md-6 offset-md-3">
<hr>
</div>
<div class="col-12 col-md-6 offset-md-3 mt-3">
<p class="h4 font-weight-bold">Post Details</p>
@if($interstitial->has_media)
<div class="py-4 align-items-center">
<div class="d-block text-center text-truncate">
@if($interstitial->blurhash)
<canvas id="mblur" width="400" height="400" class="rounded shadow"></canvas>
@else
<img src="/storage/no-preview.png" class="mr-3 img-fluid" alt="No preview available">
@endif
</div>
<div class="mt-2 border rounded p-3">
@if($meta->caption)
<p class="text-break">
Caption: <span class="font-weight-bold">{{$meta->caption}}</span>
</p>
@endif
<p class="mb-0">
Like Count: <span class="font-weight-bold">{{$meta->likes_count}}</span>
</p>
<p class="mb-0">
Share Count: <span class="font-weight-bold">{{$meta->reblogs_count}}</span>
</p>
<p class="">
Timestamp: <span class="font-weight-bold">{{now()->parse($meta->created_at)->format('r')}}</span>
</p>
<p class="mb-0" style="word-break: break-all !important;">
URL: <span class="font-weight-bold text-primary">{{$meta->url}}</span>
</p>
</div>
</div>
@else
<div class="py-4 align-items-center">
<div class="mt-2 border rounded p-3">
@if($meta->caption)
<p class="text-break">
Comment: <span class="font-weight-bold">{{$meta->caption}}</span>
</p>
@endif
<p class="mb-0">
Like Count: <span class="font-weight-bold">{{$meta->likes_count}}</span>
</p>
<p class="mb-0">
Share Count: <span class="font-weight-bold">{{$meta->reblogs_count}}</span>
</p>
<p class="">
Timestamp: <span class="font-weight-bold">{{now()->parse($meta->created_at)->format('r')}}</span>
</p>
<p class="mb-0" style="word-break: break-all !important;">
URL: <span class="font-weight-bold text-primary">{{$meta->url}}</span>
</p>
</div>
</div>
@endif
</div>
<div class="col-12 col-md-6 offset-md-3 my-3">
<div class="border rounded p-3 border-primary">
<p class="h4 font-weight-bold pt-2 text-primary">Review the Community Guidelines</p>
<p class="lead pt-4 text-primary">We want to keep {{config('app.name')}} a safe place for everyone, and we created these <a class="font-weight-bold text-primary" href="{{route('help.community-guidelines')}}">Community Guidelines</a> to support and protect our community.</p>
</div>
</div>
<div id="appealButton" class="col-12 col-md-6 offset-md-3 mt-3">
<button type="button" class="btn btn-outline-primary btn-block font-weight-bold" onclick="requestAppeal()">REQUEST APPEAL</button>
</div>
<div id="appealForm" class="col-12 col-md-6 offset-md-3 d-none mt-3">
<form method="post" action="/i/warning">
@csrf
<p class="h4 font-weight-bold">Request Appeal</p>
<p class="pt-4">
<div class="form-group">
<textarea class="form-control" rows="4" placeholder="Write your appeal request message here" name="appeal_message"></textarea>
</div>
</p>
{{-- <p class="lead"><span class="font-weight-bold">Learn more</span> about what we remove.</p> --}}
<input type="hidden" name="id" value="{{encrypt($interstitial->id)}}">
<input type="hidden" name="type" value="{{$interstitial->type}}">
<input type="hidden" name="action" value="appeal">
<button type="submit" class="btn btn-outline-primary btn-block font-weight-bold">REQUEST APPEAL</button>
</form>
</div>
<div class="col-12 col-md-6 offset-md-3 mt-4 mb-4">
<form method="post" action="/i/warning">
@csrf
<input type="hidden" name="id" value="{{encrypt($interstitial->id)}}">
<input type="hidden" name="type" value="{{$interstitial->type}}">
<input type="hidden" name="action" value="confirm">
<button type="submit" class="btn btn-primary btn-block font-weight-bold">I Understand</button>
</form>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function requestAppeal() {
$('#appealButton').addClass('d-none');
$('#appealForm').removeClass('d-none');
}
</script>
@if($interstitial->blurhash)
<script type="text/javascript">
const pixels = window.blurhash.decode("{{$interstitial->blurhash}}", 400, 400);
const canvas = document.getElementById("mblur");
const ctx = canvas.getContext("2d");
const imageData = ctx.createImageData(400, 400);
imageData.data.set(pixels);
ctx.putImageData(imageData, 0, 0);
</script>
@endif
@endpush

View file

@ -0,0 +1,99 @@
@extends('layouts.blank')
@section('content')
<div class="container mt-5">
<div class="row">
<div class="col-12 col-md-6 offset-md-3 text-center">
<p class="h1 pb-2" style="font-weight: 200">Your Post Has Been Deleted</p>
<p class="lead py-1">We removed your post because it doesn't follow our <a class="font-weight-bold text-dark" href="{{route('help.community-guidelines')}}">Community Guidelines</a>. If you violate our guidelines again, your account may be restricted or disabled.</p>
<p class="font-weight-bold alert alert-danger text-left">To continue you must click the "I Understand" button at the bottom of this page.</p>
</div>
<div class="col-12 col-md-6 offset-md-3">
<hr>
</div>
<div class="col-12 col-md-6 offset-md-3 mt-3">
<p class="h4 font-weight-bold">Post Details</p>
@if($interstitial->has_media)
<div class="py-4 align-items-center">
<div class="d-block text-center text-truncate">
@if($interstitial->blurhash)
<canvas id="mblur" width="400" height="400" class="rounded shadow"></canvas>
@else
<img src="/storage/no-preview.png" class="mr-3 img-fluid" alt="No preview available">
@endif
</div>
<div class="mt-2 border rounded p-3">
@if($meta->caption)
<p class="text-break">
Caption: <span class="font-weight-bold">{{$meta->caption}}</span>
</p>
@endif
<p class="mb-0">
Like Count: <span class="font-weight-bold">{{$meta->likes_count}}</span>
</p>
<p class="mb-0">
Share Count: <span class="font-weight-bold">{{$meta->reblogs_count}}</span>
</p>
<p class="">
Timestamp: <span class="font-weight-bold">{{now()->parse($meta->created_at)->format('r')}}</span>
</p>
<p class="mb-0" style="word-break: break-all !important;">
URL: <span class="font-weight-bold text-primary">{{$meta->url}}</span>
</p>
</div>
</div>
@else
<div class="media py-4 align-items-center">
<div class="media-body ml-2">
<p class="">
Comment: <span class="lead text-break font-weight-bold">{{$meta->caption}}</span>
</p>
<p class="mb-0 small">
Posted on {{$meta->created_at}}
</p>
<p class="mb-0 font-weight-bold text-primary">
{{$meta->url}}
</p>
</div>
</div>
@endif
</div>
<div class="col-12 col-md-6 offset-md-3 my-3">
<div class="border rounded p-3 border-primary">
<p class="h4 font-weight-bold pt-2 text-primary">Review the Community Guidelines</p>
<p class="lead pt-4 text-primary">We want to keep {{config('app.name')}} a safe place for everyone, and we created these <a class="font-weight-bold text-primary" href="{{route('help.community-guidelines')}}">Community Guidelines</a> to support and protect our community.</p>
</div>
</div>
<div class="col-12 col-md-6 offset-md-3 mt-4 mb-5">
<form method="post" action="/i/warning">
@csrf
<input type="hidden" name="id" value="{{encrypt($interstitial->id)}}">
<input type="hidden" name="type" value="{{$interstitial->type}}">
<input type="hidden" name="action" value="confirm">
<button type="submit" class="btn btn-primary btn-block font-weight-bold">I Understand</button>
</form>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function requestAppeal() {
$('#appealButton').addClass('d-none');
$('#appealForm').removeClass('d-none');
}
</script>
@if($interstitial->blurhash)
<script type="text/javascript">
const pixels = window.blurhash.decode("{{$interstitial->blurhash}}", 400, 400);
const canvas = document.getElementById("mblur");
const ctx = canvas.getContext("2d");
const imageData = ctx.createImageData(400, 400);
imageData.data.set(pixels);
ctx.putImageData(imageData, 0, 0);
</script>
@endif
@endpush

View file

@ -0,0 +1,128 @@
@extends('layouts.blank')
@section('content')
<div class="container mt-5">
<div class="row">
<div class="col-12 col-md-6 offset-md-3 text-center">
<p class="h1 pb-2" style="font-weight: 200">Your Post Was Unlisted</p>
<p class="lead py-3">We removed your post from public timelines because it doesn't follow our <a class="font-weight-bold text-dark" href="{{route('help.community-guidelines')}}">Community Guidelines</a>.</p>
</div>
<div class="col-12 col-md-6 offset-md-3">
<hr>
</div>
<div class="col-12 col-md-6 offset-md-3">
<p class="h4 font-weight-bold">Post Details</p>
@if($interstitial->has_media)
<div class="py-4 align-items-center">
<div class="d-block text-center text-truncate">
@if($interstitial->blurhash)
<canvas id="mblur" width="400" height="400" class="rounded shadow"></canvas>
@else
<img src="/storage/no-preview.png" class="mr-3 img-fluid" alt="No preview available">
@endif
</div>
<div class="mt-2 border rounded p-3">
@if($meta->caption)
<p class="text-break">
Caption: <span class="font-weight-bold">{{$meta->caption}}</span>
</p>
@endif
<p class="mb-0">
Like Count: <span class="font-weight-bold">{{$meta->likes_count}}</span>
</p>
<p class="mb-0">
Share Count: <span class="font-weight-bold">{{$meta->reblogs_count}}</span>
</p>
<p class="">
Timestamp: <span class="font-weight-bold">{{now()->parse($meta->created_at)->format('r')}}</span>
</p>
<p class="mb-0" style="word-break: break-all !important;">
URL: <span class="font-weight-bold text-primary">{{$meta->url}}</span>
</p>
</div>
</div>
@else
<div class="py-4 align-items-center">
<div class="mt-2 border rounded p-3">
@if($meta->caption)
<p class="text-break">
Comment: <span class="font-weight-bold">{{$meta->caption}}</span>
</p>
@endif
<p class="mb-0">
Like Count: <span class="font-weight-bold">{{$meta->likes_count}}</span>
</p>
<p class="mb-0">
Share Count: <span class="font-weight-bold">{{$meta->reblogs_count}}</span>
</p>
<p class="">
Timestamp: <span class="font-weight-bold">{{now()->parse($meta->created_at)->format('r')}}</span>
</p>
<p class="mb-0" style="word-break: break-all !important;">
URL: <span class="font-weight-bold text-primary">{{$meta->url}}</span>
</p>
</div>
</div>
@endif
</div>
<div class="col-12 col-md-6 offset-md-3 my-3">
<div class="border rounded p-3 border-primary">
<p class="h4 font-weight-bold pt-2 text-primary">Review the Community Guidelines</p>
<p class="lead pt-4 text-primary">We want to keep {{config('app.name')}} a safe place for everyone, and we created these <a class="font-weight-bold text-primary" href="{{route('help.community-guidelines')}}">Community Guidelines</a> to support and protect our community.</p>
</div>
</div>
<div id="appealButton" class="col-12 col-md-6 offset-md-3">
<button type="button" class="btn btn-outline-primary btn-block font-weight-bold" onclick="requestAppeal()">REQUEST APPEAL</button>
</div>
<div id="appealForm" class="col-12 col-md-6 offset-md-3 d-none">
<form method="post" action="/i/warning">
@csrf
<p class="h4 font-weight-bold">Request Appeal</p>
<p class="pt-4">
<div class="form-group">
<textarea class="form-control" rows="4" placeholder="Write your appeal request message here" name="appeal_message"></textarea>
</div>
</p>
<input type="hidden" name="id" value="{{encrypt($interstitial->id)}}">
<input type="hidden" name="type" value="{{$interstitial->type}}">
<input type="hidden" name="action" value="appeal">
<button type="submit" class="btn btn-outline-primary btn-block font-weight-bold">REQUEST APPEAL</button>
</form>
</div>
<div class="col-12 col-md-6 offset-md-3 mt-4 mb-4">
<form method="post" action="/i/warning">
@csrf
<input type="hidden" name="id" value="{{encrypt($interstitial->id)}}">
<input type="hidden" name="type" value="{{$interstitial->type}}">
<input type="hidden" name="action" value="confirm">
<button type="submit" class="btn btn-primary btn-block font-weight-bold">I Understand</button>
</form>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function requestAppeal() {
$('#appealButton').addClass('d-none');
$('#appealForm').removeClass('d-none');
}
</script>
@if($interstitial->blurhash)
<script type="text/javascript">
const pixels = window.blurhash.decode("{{$interstitial->blurhash}}", 400, 400);
const canvas = document.getElementById("mblur");
const ctx = canvas.getContext("2d");
const imageData = ctx.createImageData(400, 400);
imageData.data.set(pixels);
ctx.putImageData(imageData, 0, 0);
</script>
@endif
@endpush

View file

@ -0,0 +1,63 @@
@extends('admin.partial.template-full')
@section('section')
<div class="title mb-3">
<h3 class="font-weight-bold d-inline-block">Appeals</h3>
<span class="float-right">
</span>
</div>
<div class="row">
<div class="col-12 col-md-3 mb-3">
<div class="card border bg-primary text-white rounded-pill shadow">
<div class="card-body pl-4 ml-3">
<p class="h1 font-weight-bold mb-1" style="font-weight: 700">{{App\AccountInterstitial::whereNull('appeal_handled_at')->whereNotNull('appeal_requested_at')->count()}}</p>
<p class="lead mb-0 font-weight-lighter">active appeals</p>
</div>
</div>
<div class="mt-3 card border bg-warning text-dark rounded-pill shadow">
<div class="card-body pl-4 ml-3">
<p class="h1 font-weight-bold mb-1" style="font-weight: 700">{{App\AccountInterstitial::whereNotNull('appeal_handled_at')->whereNotNull('appeal_requested_at')->count()}}</p>
<p class="lead mb-0 font-weight-lighter">closed appeals</p>
</div>
</div>
</div>
<div class="col-12 col-md-8 offset-md-1">
<ul class="list-group">
@if($appeals->count() == 0)
<li class="list-group-item text-center py-5">
<p class="mb-0 py-5 font-weight-bold">No appeals found!</p>
</li>
@endif
@foreach($appeals as $appeal)
<a class="list-group-item text-decoration-none text-dark" href="/i/admin/reports/appeal/{{$appeal->id}}">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="{{$appeal->has_media ? $appeal->status->thumb(true) : '/storage/no-preview.png'}}" width="64" height="64" class="rounded border">
<div class="ml-2">
<span class="d-inline-block text-truncate">
<p class="mb-0 small font-weight-bold text-primary">{{$appeal->type}}</p>
@if($appeal->item_type)
<p class="mb-0 font-weight-bold">{{starts_with($appeal->item_type, 'App\\') ? explode('\\',$appeal->item_type)[1] : $appeal->item_type}}</p>
@endif
</span>
</div>
</div>
<div class="d-block">
<p class="mb-0 font-weight-bold">&commat;{{$appeal->user->username}}</p>
<p class="mb-0 small text-muted font-weight-bold">{{$appeal->created_at->diffForHumans(null, null, true)}}</p>
</div>
<div class="d-inline-block">
<p class="mb-0 small">
<i class="fas fa-chevron-right fa-2x text-lighter"></i>
</p>
</div>
</div>
</a>
@endforeach
</ul>
<p>{!!$appeals->render()!!}</p>
</div>
</div>
@endsection

View file

@ -15,6 +15,15 @@
</a> </a>
</span> </span>
</div> </div>
@php($ai = App\AccountInterstitial::whereNotNull('appeal_requested_at')->whereNull('appeal_handled_at')->count())
@if($ai)
<div class="mb-4">
<a class="btn btn-outline-primary px-5 py-3" href="/i/admin/reports/appeals">
<p class="font-weight-bold h4 mb-0">{{$ai}}</p>
Appeal {{$ai == 1 ? 'Request' : 'Requests'}}
</a>
</div>
@endif
@if($reports->count()) @if($reports->count())
<div class="card shadow-none border"> <div class="card shadow-none border">
<div class="list-group list-group-flush"> <div class="list-group list-group-flush">

View file

@ -0,0 +1,125 @@
@extends('admin.partial.template-full')
@section('section')
<div class="d-flex justify-content-between title mb-3">
<div>
<p class="font-weight-bold h3">Moderation Appeal</p>
<p class="text-muted mb-0 lead">From <a href="{{$appeal->user->url()}}" class="text-muted font-weight-bold">&commat;{{$appeal->user->username}}</a> about {{$appeal->appeal_requested_at->diffForHumans()}}.</p>
</div>
<div>
</div>
</div>
<div class="row">
<div class="col-12 col-md-8 mt-3">
@if($appeal->type == 'post.cw')
<div class="card shadow-none border">
<div class="card-header bg-light h5 font-weight-bold py-4">Content Warning applied to {{$appeal->has_media ? 'Post' : 'Comment'}}</div>
@if($appeal->has_media)
<img class="card-img-top border-bottom" src="{{$appeal->status->thumb(true)}}">
@endif
<div class="card-body">
<div class="mt-2 p-3">
@if($meta->caption)
<p class="text-break">
{{$appeal->has_media ? 'Caption' : 'Comment'}}: <span class="font-weight-bold">{{$meta->caption}}</span>
</p>
@endif
<p class="mb-0">
Like Count: <span class="font-weight-bold">{{$meta->likes_count}}</span>
</p>
<p class="mb-0">
Share Count: <span class="font-weight-bold">{{$meta->reblogs_count}}</span>
</p>
<p class="mb-0">
Timestamp: <span class="font-weight-bold">{{now()->parse($meta->created_at)->format('r')}}</span>
</p>
<p class="" style="word-break: break-all !important;">
URL: <span class="font-weight-bold text-primary"><a href="{{$meta->url}}">{{$meta->url}}</a></span>
</p>
<p class="mb-0">
Message: <span class="font-weight-bold">{{$appeal->appeal_message}}</span>
</p>
</div>
</div>
</div>
@elseif($appeal->type == 'post.unlist')
<div class="card shadow-none border">
<div class="card-header bg-light h5 font-weight-bold py-4">{{$appeal->has_media ? 'Post' : 'Comment'}} was unlisted from timelines</div>
@if($appeal->has_media)
<img class="card-img-top border-bottom" src="{{$appeal->status->thumb(true)}}">
@endif
<div class="card-body">
<div class="mt-2 p-3">
@if($meta->caption)
<p class="text-break">
{{$appeal->has_media ? 'Caption' : 'Comment'}}: <span class="font-weight-bold">{{$meta->caption}}</span>
</p>
@endif
<p class="mb-0">
Like Count: <span class="font-weight-bold">{{$meta->likes_count}}</span>
</p>
<p class="mb-0">
Share Count: <span class="font-weight-bold">{{$meta->reblogs_count}}</span>
</p>
<p class="mb-0">
Timestamp: <span class="font-weight-bold">{{now()->parse($meta->created_at)->format('r')}}</span>
</p>
<p class="" style="word-break: break-all !important;">
URL: <span class="font-weight-bold text-primary"><a href="{{$meta->url}}">{{$meta->url}}</a></span>
</p>
<p class="mb-0">
Message: <span class="font-weight-bold">{{$appeal->appeal_message}}</span>
</p>
</div>
</div>
</div>
@endif
</div>
<div class="col-12 col-md-4 mt-3">
<form method="post">
@csrf
<input type="hidden" name="action" value="dismiss">
<button type="submit" class="btn btn-primary btn-block font-weight-bold mb-3">Dismiss Appeal Request</button>
</form>
<button type="button" class="btn btn-light border btn-block font-weight-bold mb-3" onclick="approveWarning()">Approve Appeal</button>
<div class="card shadow-none border mt-5">
<div class="card-header text-center font-weight-bold bg-light">
&commat;{{$appeal->user->username}} stats
</div>
<div class="card-body">
<p class="">
Open Appeals: <span class="font-weight-bold">{{App\AccountInterstitial::whereUserId($appeal->user_id)->whereNotNull('appeal_requested_at')->whereNull('appeal_handled_at')->count()}}</span>
</p>
<p class="">
Total Appeals: <span class="font-weight-bold">{{App\AccountInterstitial::whereUserId($appeal->user_id)->whereNotNull('appeal_requested_at')->count()}}</span>
</p>
<p class="">
Total Warnings: <span class="font-weight-bold">{{App\AccountInterstitial::whereUserId($appeal->user_id)->count()}}</span>
</p>
<p class="">
Status Count: <span class="font-weight-bold">{{$appeal->user->statuses()->count()}}</span>
</p>
<p class="mb-0">
Joined: <span class="font-weight-bold">{{$appeal->user->created_at->diffForHumans(null, null, false)}}</span>
</p>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function approveWarning() {
if(window.confirm('Are you sure you want to approve this appeal?') == true) {
axios.post(window.location.href, {
action: 'approve'
}).then(res => {
window.location.href = '/i/admin/reports/appeals';
}).catch(err => {
swal('Oops!', 'An error occured, please try again later.', 'error');
});
}
}
</script>
@endpush