Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-08-24 12:48:26 +0300
committerJoas Schilling <coding@schilljs.com>2022-08-31 13:22:39 +0300
commit16a1590faf054cc530cea8d42ddc9ee63f955cc9 (patch)
tree9a5a262ebfcb9328e72bcdbfc07c0ca254074dbf /lib
parentf5afbee23537f8ab0d4a0e0083e17f26c74c5cf8 (diff)
Show a warning about undelivered notifications
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Listener/BeforeTemplateRenderedListener.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Listener/BeforeTemplateRenderedListener.php b/lib/Listener/BeforeTemplateRenderedListener.php
index ce56e88..cce3b83 100644
--- a/lib/Listener/BeforeTemplateRenderedListener.php
+++ b/lib/Listener/BeforeTemplateRenderedListener.php
@@ -35,19 +35,23 @@ use OCP\EventDispatcher\IEventListener;
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserSession;
+use OCP\Notification\IManager;
use OCP\Util;
class BeforeTemplateRenderedListener implements IEventListener {
protected IConfig $config;
protected IUserSession $userSession;
protected IInitialState $initialState;
+ protected IManager $notificationManager;
public function __construct(IConfig $config,
IUserSession $userSession,
- IInitialState $initialState) {
+ IInitialState $initialState,
+ IManager $notificationManager) {
$this->config = $config;
$this->userSession = $userSession;
$this->initialState = $initialState;
+ $this->notificationManager = $notificationManager;
}
public function handle(Event $event): void {
@@ -84,6 +88,16 @@ class BeforeTemplateRenderedListener implements IEventListener {
) === 'yes'
);
+ /**
+ * We want to keep offering our push notification service for free, but large
+ * users overload our infrastructure. For this reason we have to rate-limit the
+ * use of push notifications. If you need this feature, consider using Nextcloud Enterprise.
+ */
+ $this->initialState->provideInitialState(
+ 'throttled_push_notifications',
+ !$this->notificationManager->isFairUseOfFreePushService()
+ );
+
Util::addScript('notifications', 'notifications-main');
}
}