Added notification on job fail
All checks were successful
Push image to registry / build-image (push) Successful in 5m20s
All checks were successful
Push image to registry / build-image (push) Successful in 5m20s
This commit is contained in:
@ -4,6 +4,7 @@ namespace App\Notification;
|
||||
|
||||
use App\Models\Job;
|
||||
use App\Notification\Stringifiable\StringifiableSimpleText;
|
||||
use function PHPUnit\Framework\isNull;
|
||||
|
||||
abstract class Notification {
|
||||
|
||||
@ -12,12 +13,18 @@ abstract class Notification {
|
||||
|
||||
public bool $isError;
|
||||
|
||||
public function __construct(int $jobId, NotificationBody $body, bool $isError = false) {
|
||||
public function __construct(int $jobId, NotificationBody $body = null, bool $isError = false) {
|
||||
$this->job = Job::find($jobId);
|
||||
$this->body = $body;
|
||||
if (!isNull($body)) {
|
||||
$this->body = $body;
|
||||
}
|
||||
$this->isError = $isError;
|
||||
}
|
||||
|
||||
public function setBody(NotificationBody $body) {
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
public function getTitle(): Stringifiable {
|
||||
return new StringifiableSimpleText($this->job->name);
|
||||
}
|
||||
|
Reference in New Issue
Block a user