A lot of things

This commit is contained in:
2026-06-16 16:21:43 +02:00
parent 4415a2e8c4
commit 73471162bf
37 changed files with 654 additions and 4 deletions

View File

@@ -0,0 +1,41 @@
<?php
namespace RomhackPlaza\Master\XF\Entity;
use RomhackPlaza\Master\Helper\Helpers;
class ApprovalQueue extends XFCP_ApprovalQueue
{
protected function _postSave()
{
parent::_postSave();
if( $this->isInsert() ){
$contentId = $this->content_id;
$contentType = $this->content_type;
\XF::runLater(function () use ($contentId, $contentType) {
$entity = \XF::app()->getContentTypeFieldValue($contentType, 'entity');
if( !$entity ){
return;
}
$content = \XF::em()->find($entity, $contentId);
$user = $contentType === 'user' ? $content : $content->User;
$service = \XF::service('RomhackPlaza\Master:Discord\BotService');
$service->createAction( 'approval_queue', [
'content_title' => Helpers::getContentTitle( $content, $contentType ),
'approval_item_url' => \XF::app()->router('public')->buildLink('canonical:approval-queue' ),
'approval_username' => $user?->username ?? '',
'approval_user_url' => $user?->user_id ? \XF::app()->router('public')->buildLink('canonical:members', $user ) : '',
'content_type' => $contentType,
]);
});
}
}
}

View File

@@ -15,4 +15,9 @@ class User extends XFCP_User
return $structure;
}
public function canCreateEntry()
{
return \XF::visitor()->hasPermission('romhackplaza', 'canSubmitEntry');
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace RomhackPlaza\Master\XF\Pub\Controller;
use XF\Mvc\ParameterBag;
class MiscController extends XFCP_MiscController
{
public function actionPreferencesPopup()
{
return $this->view('RomhackPlaza\Master:Misc\PreferencesPopup', 'misc_preferences_popup');
}
}

View 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;
}
}