Skip to content

Commit

Permalink
fix(notifications): Fix rendering of legacy notifications
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Jul 23, 2024
1 parent e056862 commit c0ef469
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/Notifier/AdminNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,21 @@ public function prepare(INotification $notification, string $languageCode): INot
case 'cli':
case 'ocs':
$subjectParams = $notification->getSubjectParameters();
if ($subjectParams['parsed'] !== '') {
$notification->setParsedSubject($subjectParams['parsed']);
}
if ($subjectParams['rich'] !== '') {
$notification->setRichSubject($subjectParams['rich'], $subjectParams['parameters']);
if (isset($subjectParams['subject'])) {
// Nextcloud 30+
$notification->setRichSubject($subjectParams['subject'], $subjectParams['parameters']);
} else {
// Legacy before Nextcloud 30 (v3)
$notification->setParsedSubject($subjectParams[0]);
}
$messageParams = $notification->getMessageParameters();
if (!empty($messageParams)) {
if ($messageParams['parsed'] !== '') {
$notification->setParsedMessage($messageParams['parsed']);
}
if ($messageParams['rich'] !== '') {
$notification->setRichMessage($messageParams['rich'], $messageParams['parameters']);
if (!empty($messageParams['message'])) {
// Nextcloud 30+
$notification->setRichMessage($messageParams['message'], $messageParams['parameters']);
} elseif (!empty($messageParams[0])) {
// Legacy before Nextcloud 30 (v3)
$notification->setParsedMessage($messageParams[0]);
}
}

Expand Down

0 comments on commit c0ef469

Please sign in to comment.