A lot of things
This commit is contained in:
38
XF/Service/Report/CreatorService.php
Normal file
38
XF/Service/Report/CreatorService.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user