Skip to content

Commit

Permalink
Merge pull request #1755 from nextcloud/backport/1753/stable27
Browse files Browse the repository at this point in the history
[stable27] fix(push): Allow apps to provide already parsed notifications
  • Loading branch information
nickvergessen authored Dec 15, 2023
2 parents 2c888ec + d8e9046 commit 32ae027
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 @@ -299,13 +299,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 32ae027

Please sign in to comment.