diff --git a/app/Notification/Notification.php b/app/Notification/Notification.php index 3950958..33174b6 100644 --- a/app/Notification/Notification.php +++ b/app/Notification/Notification.php @@ -15,7 +15,7 @@ abstract class Notification { public function __construct(int $jobId, NotificationBody $body = null, bool $isError = false) { $this->job = Job::find($jobId); - if (!isNull($body)) { + if ($body !== null) { $this->body = $body; } $this->isError = $isError; diff --git a/app/Notification/NotificationBody/JobDebugNotificationBody.php b/app/Notification/NotificationBody/JobDebugNotificationBody.php index f668f69..64d07f5 100644 --- a/app/Notification/NotificationBody/JobDebugNotificationBody.php +++ b/app/Notification/NotificationBody/JobDebugNotificationBody.php @@ -9,14 +9,12 @@ use App\Notification\Stringifiable; class JobDebugNotificationBody extends NotificationBody { private Job $job; - private string $title; private string $body; - private string $error; + private ?string $error; private bool $hasScreenshot; - public function __construct(Job $job, string $title, string $body, string $error, bool $hasScreenshot = false) { + public function __construct(Job $job, string $body, string $error = null, bool $hasScreenshot = false) { $this->job = $job; - $this->title = $title; $this->body = $body; $this->error = $error; $this->hasScreenshot = $hasScreenshot; diff --git a/app/Notification/Notifications/Hellcase/HellcaseNotificationDailyFree.php b/app/Notification/Notifications/Hellcase/HellcaseNotificationDailyFree.php index 41299cf..6d9f069 100644 --- a/app/Notification/Notifications/Hellcase/HellcaseNotificationDailyFree.php +++ b/app/Notification/Notifications/Hellcase/HellcaseNotificationDailyFree.php @@ -3,12 +3,9 @@ namespace App\Notification\Notifications\Hellcase; use App\Browser\Jobs\Hellcase\HellcaseDailyFreeScreenshot; -use App\Browser\Jobs\Hellcase\HellcaseLoginQrCode; use App\Notification\Notification; -use App\Notification\Notifications\NotificationLogin; -use Laravel\Dusk\Browser; -class HellcaseNotificationDailyFree extends NotificationLogin { +class HellcaseNotificationDailyFree extends Notification { public function __construct(int $jobId, \App\Notification\NotificationBody $body) { parent::__construct($jobId, $body); diff --git a/app/Notification/Notifications/JobDebugNotification.php b/app/Notification/Notifications/JobDebugNotification.php index dadb933..f7d53fa 100644 --- a/app/Notification/Notifications/JobDebugNotification.php +++ b/app/Notification/Notifications/JobDebugNotification.php @@ -7,17 +7,21 @@ use App\Notification\Notification; use App\Notification\NotificationBody\JobDebugNotificationBody; use App\Notification\Stringifiable; use App\Notification\Stringifiable\StringifiableSimpleText; +use Illuminate\Support\Facades\Log; class JobDebugNotification extends Notification { private string|null $title; private string|null $screenShotProjectPath; - public function __construct(int $jobId, string $body, string $title = null, string $error = null, string $screenshotProjectPath = JobDebugScreenshot::getImgFileProjectPath($jobId), bool $isError = false) { + public function __construct(int $jobId, string $body, string $title = null, string $error = null, ?string $screenshotProjectPath = "", bool $isError = false) { parent::__construct($jobId, isError:$isError); $this->title = $title; + if ($screenshotProjectPath === "") { + $screenshotProjectPath = JobDebugScreenshot::getImgFileProjectPath($jobId); + } $this->screenShotProjectPath = $screenshotProjectPath; - $this->setBody(new JobDebugNotificationBody($this->job, $this->title, $body, $error, $this->screenShotProjectPath != null)); + $this->setBody(new JobDebugNotificationBody($this->job, $body, $error, $this->screenShotProjectPath != null)); } public function getTitle(): Stringifiable {