1
0
Fork 0
pixelfed/app/Mail/AdminNewAutospam.php

80 lines
1.9 KiB
PHP
Raw Normal View History

2023-03-13 11:55:56 +00:00
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
use App\Services\AccountService;
use App\Services\StatusService;
class AdminNewAutospam extends Mailable
{
use Queueable, SerializesModels;
public $report;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($report)
{
$this->report = $report;
}
/**
* Get the message envelope.
*
* @return \Illuminate\Mail\Mailables\Envelope
*/
public function envelope()
{
return new Envelope(
2023-04-24 09:26:36 +00:00
subject: '[' . config('pixelfed.domain.app') . '] Spam Post Detected (Ref: autospam-' . $this->report->id . ')',
2023-03-13 11:55:56 +00:00
);
}
/**
* Get the message content definition.
*
* @return \Illuminate\Mail\Mailables\Content
*/
public function content()
{
$data = $this->report->toArray();
$reported_status = null;
$reported_account = null;
$url = url('/i/admin/reports/autospam/' . $this->report->id . '?ref=email');
2023-03-13 11:55:56 +00:00
if($data['item_type'] === 'App\Status') {
$reported_status = StatusService::get($this->report->item_id, false);
$reported_account = AccountService::get($reported_status['account']['id'], true);
}
return new Content(
markdown: 'emails.admin.new_autospam',
with: [
'report' => $data,
'url' => $url,
'reported_status' => $reported_status,
'reported_account' => $reported_account
]
);
}
/**
* Get the attachments for the message.
*
* @return array
*/
public function attachments()
{
return [];
}
}