Skip to content

Commit

Permalink
Merge pull request #1754 from nextcloud/backport/1753/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(push): Allow apps to provide already parsed notifications
  • Loading branch information
nickvergessen authored Dec 14, 2023
2 parents 99d8350 + b54846c commit d81c7d3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,15 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf
$language = $this->l10nFactory->getUserLanguage($user);
$this->printInfo('Language is set to ' . $language);

try {
$this->notificationManager->setPreparingPushNotification(true);
$notification = $this->notificationManager->prepare($notification, $language);
} catch (\InvalidArgumentException $e) {
return;
} finally {
$this->notificationManager->setPreparingPushNotification(false);
if (!$notification->isValidParsed()) {
try {
$this->notificationManager->setPreparingPushNotification(true);
$notification = $this->notificationManager->prepare($notification, $language);
} catch (\InvalidArgumentException $e) {
return;
} finally {
$this->notificationManager->setPreparingPushNotification(false);
}
}

$userKey = $this->keyManager->getKey($user);
Expand Down

0 comments on commit d81c7d3

Please sign in to comment.