A lot of things

This commit is contained in:
2026-06-16 16:21:43 +02:00
parent 4f9f6c63b3
commit 7e1e26f20b
126 changed files with 7917 additions and 204 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Helpers;
use App\Auth\XenForoUser;
use App\Models\Entry;
use App\Models\News;
use App\Services\XenforoApiService;
class XenForoHelpers {
@@ -44,7 +45,7 @@ class XenForoHelpers {
$service->updateEntriesCount( $count, $userId );
}
public static function entryApproved( Entry $entry ): void
public static function entryApproved( Entry|News $entry ): void
{
// 1. Update XF Entry count.
self::updateEntriesCount( $entry->user_id );
@@ -58,6 +59,29 @@ class XenForoHelpers {
$title = "Entry approved : {$entry->title}";
$message = "Your entry {$entry->title} has been approved by {$moderator}.";
$service = app(XenForoApiService::class);
$service->createConversation([ $entry->user_id ], $title, $message, false, false);
}
public static function entryRejected( Entry|News $entry ): void
{
// 1. Update XF Entry count.
self::updateEntriesCount( $entry->user_id );
// 2. Send a private message
/*
if( \Auth::user()->user_id === $entry->user_id ) {
return;
}
*/
$moderator = \Auth::user()->username;
$title = "Entry rejected : {$entry->title}";
$message = "Your entry {$entry->title} has been rejected by {$moderator}.\nReason: {$entry->staff_comment}\n\nYou have 7 days to edit your entry before it is permanently deleted.";
$service = app(XenForoApiService::class);
$service->createConversation([ $entry->user_id ], $title, $message, false, false);
}
}