mirror of https://github.com/pixelfed/pixelfed
commit
07182a5797
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs\ContactPipeline;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use App\Contact;
|
||||||
|
use App\Mail\ContactAdmin;
|
||||||
|
use Mail;
|
||||||
|
|
||||||
|
class ContactPipeline implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
protected $contact;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct(Contact $contact)
|
||||||
|
{
|
||||||
|
$this->contact = $contact;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$contact = $this->contact;
|
||||||
|
$email = config('instance.email');
|
||||||
|
if(config('instance.contact.enabled') == false || $contact->read_at !== null || filter_var($email, FILTER_VALIDATE_EMAIL) == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Mail::to($email)->send(new ContactAdmin($contact));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
@extends('admin.partial.template-full')
|
||||||
|
|
||||||
|
@section('section')
|
||||||
|
<div class="title">
|
||||||
|
<h3 class="font-weight-bold d-inline-block">Messages</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead class="bg-light">
|
||||||
|
<tr>
|
||||||
|
<th scope="col">#</th>
|
||||||
|
<th scope="col">User</th>
|
||||||
|
<th scope="col">Message</th>
|
||||||
|
<th scope="col">Created</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($messages as $msg)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="/i/admin/messages/show/{{$msg->id}}" class="btn btn-sm btn-outline-primary">
|
||||||
|
{{$msg->id}}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td class="font-weight-bold"><a href="{{$msg->user->url()}}">{{$msg->user->username}}</a></td>
|
||||||
|
<td class="font-weight-bold">{{str_limit($msg->message, 40)}}</td>
|
||||||
|
<td class="font-weight-bold">{{$msg->created_at->diffForHumans()}}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{{$messages->links()}}
|
||||||
|
@endsection
|
@ -0,0 +1,68 @@
|
|||||||
|
@extends('admin.partial.template-full')
|
||||||
|
|
||||||
|
@section('section')
|
||||||
|
<div class="title">
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<div class="font-weight-bold"># {{$message->id}}</div>
|
||||||
|
<div class="font-weight-bold h3">Message</div>
|
||||||
|
<div>
|
||||||
|
@if($message->read_at)
|
||||||
|
<span class="btn btn-outline-secondary btn-sm disabled" disabled>Read</span>
|
||||||
|
@else
|
||||||
|
<button type="button" class="btn btn-outline-primary btn-sm" id="markRead">Mark Read</button>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col-12 col-md-3 text-md-right">
|
||||||
|
@if($message->response_requested)
|
||||||
|
<p class="text-dark font-weight-bold">Response Requested</p>
|
||||||
|
@endif
|
||||||
|
<p class="text-dark">Sent {{$message->created_at->diffForHumans()}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-6">
|
||||||
|
|
||||||
|
<div class="card shadow-none border">
|
||||||
|
<div class="card-header bg-white">
|
||||||
|
<div class="media">
|
||||||
|
<img src="{{$message->user->profile->avatarUrl()}}" class="mr-3 rounded-circle" width="40px" height="40px">
|
||||||
|
<div class="media-body">
|
||||||
|
<h5 class="my-0">@{{$message->user->username}}</h5>
|
||||||
|
<span class="text-muted">{{$message->user->email}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<p class="mb-0">{{$message->message}}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-3">
|
||||||
|
{{-- @if($message->responded_at == null)
|
||||||
|
<button class="btn btn-primary font-weight-bold btn-block">Send Response</button>
|
||||||
|
<hr>
|
||||||
|
@endif
|
||||||
|
<button class="btn btn-outline-danger font-weight-bold btn-block">Delete</button> --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('#markRead').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
axios.post('/i/admin/messages/mark-read', {
|
||||||
|
id: '{{$message->id}}',
|
||||||
|
}).then(res => {
|
||||||
|
window.location.href = window.location.href;
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
@endpush
|
Loading…
Reference in New Issue