From d8e90466515909ee3242e6b81054281fdefde20b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 13 Dec 2023 10:23:53 +0100 Subject: [PATCH] fix(push): Allow apps to provide already parsed notifications Signed-off-by: Joas Schilling --- lib/Push.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/Push.php b/lib/Push.php index ff12ccbaf..4e74d5968 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -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);