Skip to content

Commit 517a5cc

Browse files
Merge pull request #1756 from nextcloud/backport/1753/stable26
[stable26] fix(push): Allow apps to provide already parsed notifications
2 parents 8f326bc + aa85aa1 commit 517a5cc

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

lib/Push.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,15 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf
299299
$language = $this->l10nFactory->getUserLanguage($user);
300300
$this->printInfo('Language is set to ' . $language);
301301

302-
try {
303-
$this->notificationManager->setPreparingPushNotification(true);
304-
$notification = $this->notificationManager->prepare($notification, $language);
305-
} catch (\InvalidArgumentException $e) {
306-
return;
307-
} finally {
308-
$this->notificationManager->setPreparingPushNotification(false);
302+
if (!$notification->isValidParsed()) {
303+
try {
304+
$this->notificationManager->setPreparingPushNotification(true);
305+
$notification = $this->notificationManager->prepare($notification, $language);
306+
} catch (\InvalidArgumentException $e) {
307+
return;
308+
} finally {
309+
$this->notificationManager->setPreparingPushNotification(false);
310+
}
309311
}
310312

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

0 commit comments

Comments
 (0)