Skip to content

Commit

Permalink
fix(mail): Fix mail handling when force_language is true or false
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and backportbot-nextcloud[bot] committed Dec 8, 2023
1 parent f328beb commit c65073d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/MailNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> $userLanguages */
$userLanguages = [];
} else {
$fallbackLang = $this->config->getSystemValueString('default_language', 'en');
/** @psalm-var array<string, string> $userLanguages */
$userLanguages = $this->config->getUserValueForUsers('core', 'lang', $userIds);
}

foreach ($userSettings as $settings) {
Expand Down

0 comments on commit c65073d

Please sign in to comment.