A lot of things
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user