38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace RomhackPlaza\Master\XF\Service\Report;
|
||
|
|
|
||
|
|
use XF\Entity\Report;
|
||
|
|
use XF\Repository\ReportRepository;
|
||
|
|
|
||
|
|
class CreatorService extends XFCP_CreatorService
|
||
|
|
{
|
||
|
|
protected function _save()
|
||
|
|
{
|
||
|
|
/** @var Report $report */
|
||
|
|
$report = parent::_save();
|
||
|
|
|
||
|
|
if( $report ){
|
||
|
|
|
||
|
|
\XF::runLater(function () use ($report){
|
||
|
|
$reportRepo = $this->repository(ReportRepository::class);
|
||
|
|
$handler = $reportRepo->getReportHandler($report->content_type, true);
|
||
|
|
$service = \XF::service('RomhackPlaza\Master:Discord\BotService');
|
||
|
|
|
||
|
|
$service->createAction('report_message', [
|
||
|
|
'content_title' => $handler->getContentTitle( $report ),
|
||
|
|
'report_message' => $report->Comments->last()->message,
|
||
|
|
'report_manage_url' => \XF::app()->router('public')->buildLink('canonical:reports', $report ),
|
||
|
|
'report_username' => $report->User?->username ?? "Unknown user",
|
||
|
|
'report_user_url' => \XF::app()->router('public')->buildLink('canonical:members', $report->User ),
|
||
|
|
'content_type' => $report->content_type,
|
||
|
|
'content_link' => $handler->getContentLink( $report )
|
||
|
|
]);
|
||
|
|
});
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
return $report;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|