From 30d96e06cdaf022ed475f6fcdeaa8e388a83df4a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 8 Dec 2023 08:08:30 +0100 Subject: [PATCH] fix(mail): Fix mail handling when force_language is true or false Signed-off-by: Joas Schilling --- lib/MailNotifications.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/MailNotifications.php b/lib/MailNotifications.php index 208d8ea99..ef7ff2488 100644 --- a/lib/MailNotifications.php +++ b/lib/MailNotifications.php @@ -135,11 +135,13 @@ public function sendEmails(int $batchSize, int $sendTime): void { $userEnabled = $this->config->getUserValueForUsers('core', 'enabled', $userIds); $fallbackLang = $this->config->getSystemValue('force_language', null); - if ($fallbackLang === null) { - $fallbackLang = $this->config->getSystemValue('default_language', 'en'); - $userLanguages = $this->config->getUserValueForUsers('core', 'lang', $userIds); - } else { + if (is_string($fallbackLang)) { + /** @psalm-var array $userLanguages */ $userLanguages = []; + } else { + $fallbackLang = $this->config->getSystemValueString('default_language', 'en'); + /** @psalm-var array $userLanguages */ + $userLanguages = $this->config->getUserValueForUsers('core', 'lang', $userIds); } foreach ($userSettings as $settings) {