diff options
Diffstat (limited to 'lib/private/Notification')
-rw-r--r-- | lib/private/Notification/Manager.php | 16 | ||||
-rw-r--r-- | lib/private/Notification/Notification.php | 18 |
2 files changed, 21 insertions, 13 deletions
diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index b75e52deacb..0cbda651a8b 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -21,6 +21,7 @@ use OCP\Notification\IncompleteNotificationException; use OCP\Notification\IncompleteParsedNotificationException; use OCP\Notification\INotification; use OCP\Notification\INotifier; +use OCP\Notification\IPreloadableNotifier; use OCP\Notification\UnknownNotificationException; use OCP\RichObjectStrings\IRichTextFormatter; use OCP\RichObjectStrings\IValidator; @@ -217,7 +218,9 @@ class Manager implements IManager { * @since 8.2.0 */ public function hasNotifiers(): bool { - return !empty($this->notifiers) || !empty($this->notifierClasses); + return !empty($this->notifiers) + || !empty($this->notifierClasses) + || (!$this->parsedRegistrationContext && !empty($this->coordinator->getRegistrationContext()->getNotifierServices())); } /** @@ -388,6 +391,17 @@ class Manager implements IManager { return $notification; } + public function preloadDataForParsing(array $notifications, string $languageCode): void { + $notifiers = $this->getNotifiers(); + foreach ($notifiers as $notifier) { + if (!($notifier instanceof IPreloadableNotifier)) { + continue; + } + + $notifier->preloadDataForParsing($notifications, $languageCode); + } + } + /** * @param INotification $notification */ diff --git a/lib/private/Notification/Notification.php b/lib/private/Notification/Notification.php index f8f1e247854..fcce7fd0020 100644 --- a/lib/private/Notification/Notification.php +++ b/lib/private/Notification/Notification.php @@ -429,8 +429,7 @@ class Notification implements INotification { public function isValid(): bool { return $this->isValidCommon() - && - $this->getSubject() !== '' + && $this->getSubject() !== '' ; } @@ -456,8 +455,7 @@ class Notification implements INotification { return $this->isValidCommon() - && - $this->getParsedSubject() !== '' + && $this->getParsedSubject() !== '' ; } @@ -468,14 +466,10 @@ class Notification implements INotification { return $this->getApp() !== '' - && - $this->getUser() !== '' - && - $this->getDateTime()->getTimestamp() !== 0 - && - $this->getObjectType() !== '' - && - $this->getObjectId() !== '' + && $this->getUser() !== '' + && $this->getDateTime()->getTimestamp() !== 0 + && $this->getObjectType() !== '' + && $this->getObjectId() !== '' ; } } |