Fix variable names to use camelCase
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
fc0d42f30d
commit
23408740ee
|
|
@ -119,29 +119,30 @@ class MailService {
|
||||||
|
|
||||||
public function notifyAdmins(string $userId, bool $userIsEnabled, string $userGroupId): void {
|
public function notifyAdmins(string $userId, bool $userIsEnabled, string $userGroupId): void {
|
||||||
// Notify admin
|
// Notify admin
|
||||||
$admin_users = $this->groupManager->get('admin')->getUsers();
|
$adminUsers = $this->groupManager->get('admin')->getUsers();
|
||||||
|
|
||||||
// if the user is disabled and belongs to a group
|
// if the user is disabled and belongs to a group
|
||||||
// add subadmins of this group to notification list
|
// add subadmins of this group to notification list
|
||||||
if (!$userIsEnabled && $userGroupId) {
|
if (!$userIsEnabled && $userGroupId) {
|
||||||
$group = $this->groupManager->get($userGroupId);
|
$group = $this->groupManager->get($userGroupId);
|
||||||
$subadmin_users = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($group);
|
$subAdmins = $this->groupManager->getSubAdmin()->getGroupsSubAdmins($group);
|
||||||
foreach ($subadmin_users as $user) {
|
foreach ($subAdmins as $subAdmin) {
|
||||||
if (!in_array($user, $admin_users, true)) {
|
if (!in_array($subAdmin, $adminUsers, true)) {
|
||||||
$admin_users[] = $user;
|
$adminUsers[] = $subAdmin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$to_arr = [];
|
$toArr = [];
|
||||||
foreach ($admin_users as $au) {
|
foreach ($adminUsers as $adminUser) {
|
||||||
$au_email = $au->getEMailAddress();
|
$email = $adminUser->getEMailAddress();
|
||||||
if ($au_email && $au->isEnabled()) {
|
if ($email && $adminUser->isEnabled()) {
|
||||||
$to_arr[$au_email] = $au->getDisplayName();
|
$toArr[$email] = $adminUser->getDisplayName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->sendNewUserNotifyEmail($to_arr, $userId, $userIsEnabled);
|
$this->sendNewUserNotifyEmail($toArr, $userId, $userIsEnabled);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->error('Sending admin notification email failed: '. $e->getMessage());
|
$this->logger->error('Sending admin notification email failed: '. $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -199,9 +200,9 @@ class MailService {
|
||||||
$message->setTo([]);
|
$message->setTo([]);
|
||||||
$message->setBcc($to);
|
$message->setBcc($to);
|
||||||
$message->useTemplate($template);
|
$message->useTemplate($template);
|
||||||
$failed_recipients = $this->mailer->send($message);
|
$failedRecipients = $this->mailer->send($message);
|
||||||
if (!empty($failed_recipients)) {
|
if (!empty($failedRecipients)) {
|
||||||
throw new RegistrationException('Failed recipients: '.print_r($failed_recipients, true));
|
throw new RegistrationException('Failed recipients: ' . print_r($failedRecipients, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue