diff --git a/apps/files_sharing/lib/Service/NotificationPublisher.php b/apps/files_sharing/lib/Service/NotificationPublisher.php index 24bfab54ddf3..05fc0dd9f969 100644 --- a/apps/files_sharing/lib/Service/NotificationPublisher.php +++ b/apps/files_sharing/lib/Service/NotificationPublisher.php @@ -20,6 +20,7 @@ */ namespace OCA\Files_Sharing\Service; +use OCP\BackgroundJob\IJobList; use OCP\IURLGenerator; use OCP\IUserManager; use OCP\IGroupManager; @@ -117,6 +118,12 @@ public function sendNotification(IShare $share) { $this->notificationManager->notify($notification); } + + /** + * Finally notify users via email This task would run + * as a background job. + */ + $this->notificationManager->emailNotify($share->getFullId()); } /** diff --git a/lib/private/Notification/Manager.php b/lib/private/Notification/Manager.php index 0e945ccf09f9..ef8f966569ca 100644 --- a/lib/private/Notification/Manager.php +++ b/lib/private/Notification/Manager.php @@ -244,6 +244,16 @@ public function notify(INotification $notification) { } } + /** + * @param string $shareFullId + * @return null + */ + public function emailNotify($shareFullId) { + foreach ($this->getApps() as $app) { + $app->emailNotify($shareFullId); + } + } + /** * @param INotification $notification * @param string $languageCode The code of the language that should be used to prepare the notification diff --git a/lib/public/Notification/IApp.php b/lib/public/Notification/IApp.php index 75cc7f170b4f..5a388bd9725b 100644 --- a/lib/public/Notification/IApp.php +++ b/lib/public/Notification/IApp.php @@ -49,4 +49,12 @@ public function markProcessed(INotification $notification); * @since 9.0.0 */ public function getCount(INotification $notification); + + /** + * Notification of a share to user(s) by email is achieved by background job + * @param string $shareFullId + * @return null + * @since 10.1.0 + */ + public function emailNotify($shareFullId); } diff --git a/lib/public/Notification/IManager.php b/lib/public/Notification/IManager.php index efa472d5c1f1..8f4ca2611c79 100644 --- a/lib/public/Notification/IManager.php +++ b/lib/public/Notification/IManager.php @@ -63,4 +63,11 @@ public function createNotification(); * @since 9.0.0 */ public function hasNotifiers(); + + /** + * @param string $shareFullId + * @return null + * @since 10.1.0 + */ + public function emailNotify($shareFullId); }