Commit 1a411f0a authored by Oana-Eliza Alexa's avatar Oana-Eliza Alexa
Browse files

use utils

1 merge request!76Draft: Resolve "Redesign notifications class"
Pipeline #32453 failed with stages
in 17 seconds
Showing with 10 additions and 13 deletions
+10 -13
...@@ -6,11 +6,13 @@ class Notifications implements EndpointInterface ...@@ -6,11 +6,13 @@ class Notifications implements EndpointInterface
private TaskGateway $gateway; private TaskGateway $gateway;
private string $errorMessage = 'No matching audited attributes with monitored attributes, safely removed!'; private string $errorMessage = 'No matching audited attributes with monitored attributes, safely removed!';
private Utils $utils; private Utils $utils;
private MailUtils $mailUtils;
public function __construct (TaskGateway $gateway) public function __construct (TaskGateway $gateway)
{ {
$this->gateway = $gateway; $this->gateway = $gateway;
$this->utils = new Utils(); $this->utils = new Utils();
$this->mailUtils = new MailUtils();
} }
/** /**
...@@ -320,19 +322,14 @@ class Notifications implements EndpointInterface ...@@ -320,19 +322,14 @@ class Notifications implements EndpointInterface
foreach ($notifications as $data) { foreach ($notifications as $data) {
$numberOfRecipients = count($data['mailForm']['recipients']); $numberOfRecipients = count($data['mailForm']['recipients']);
$setFrom = $data['mailForm']['setFrom'];
$mail_controller = new \FusionDirectory\Mail\MailLib( $recipients = $data['mailForm']['recipients'];
$data['mailForm']['setFrom'], $body = $data['mailForm']['body'];
NULL, $signature = $data['mailForm']['signature'];
$data['mailForm']['recipients'], $subject = $data['mailForm']['subject'];
$data['mailForm']['body'], $receipt = $data['mailForm']['receipt'];
$data['mailForm']['signature'],
$data['mailForm']['subject'], $mailSentResult = $this->mailUtils->sendMail($setFrom, NULL, $recipients, $body, $signature, $subject, $receipt, NULL);
$data['mailForm']['receipt'],
NULL
);
$mailSentResult = $mail_controller->sendMail();
$result[] = $this->processMailResponseAndUpdateTasks($mailSentResult, $data, $fdTasksConf); $result[] = $this->processMailResponseAndUpdateTasks($mailSentResult, $data, $fdTasksConf);
// Verification anti-spam max mails to be sent and quit loop if matched. // Verification anti-spam max mails to be sent and quit loop if matched.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment