fix: [internal] Append variable just when not null

pull/8155/head
Jakub Onderka 2022-02-22 16:42:56 +01:00
parent a60825cbcc
commit 9bc899e3a4
2 changed files with 12 additions and 8 deletions

View File

@ -281,7 +281,7 @@ class EventShell extends AppShell
$userId = $this->args[0];
$jobId = $this->args[1];
$eventId = $this->args[2];
$oldpublish = $this->args[3];
$oldpublish = isset($this->args[3]) ? $this->args[3] : null;
$user = $this->getUser($userId);
$this->Event->sendAlertEmail($eventId, $user, $oldpublish, $jobId);
}

View File

@ -3166,16 +3166,20 @@ class Event extends AppModel
$job = ClassRegistry::init('Job');
$jobId = $job->createJob($user, Job::WORKER_EMAIL, 'publish_alert_email', "Event: $id", 'Sending...');
$args = [
'alertemail',
$user['id'],
$jobId,
$id,
];
if ($oldpublish !== null) {
$args[] = $oldpublish;
}
$this->getBackgroundJobsTool()->enqueue(
BackgroundJobsTool::EMAIL_QUEUE,
BackgroundJobsTool::CMD_EVENT,
[
'alertemail',
$user['id'],
$jobId,
$id,
$oldpublish
],
$args,
true,
$jobId
);