diff --git a/src/bundle/Controller/NotificationController.php b/src/bundle/Controller/NotificationController.php index 85e6cdae38..06802980a3 100644 --- a/src/bundle/Controller/NotificationController.php +++ b/src/bundle/Controller/NotificationController.php @@ -108,6 +108,7 @@ public function renderNotificationsPageAction(int $page): Response 'page' => $page, 'pagination' => $pagination, 'notifications' => $notifications, + 'notifications_count_interval' => $this->configResolver->getParameter('notifications.count.interval'), 'pager' => $pagerfanta, ])->getContent()); } diff --git a/src/bundle/Resources/config/ezplatform_default_settings.yaml b/src/bundle/Resources/config/ezplatform_default_settings.yaml index 436ee5cb5c..c90fa6971a 100644 --- a/src/bundle/Resources/config/ezplatform_default_settings.yaml +++ b/src/bundle/Resources/config/ezplatform_default_settings.yaml @@ -43,6 +43,7 @@ parameters: ibexa.site_access.config.admin_group.subtree_operations.copy_subtree.limit: 100 # Notifications + ibexa.site_access.config.admin_group.notifications.count.interval: 30000 ibexa.site_access.config.admin_group.notifications.error.timeout: 0 ibexa.site_access.config.admin_group.notifications.warning.timeout: 0 ibexa.site_access.config.admin_group.notifications.success.timeout: 5000 diff --git a/src/bundle/Resources/public/js/scripts/admin.notifications.modal.js b/src/bundle/Resources/public/js/scripts/admin.notifications.modal.js index 3ced693d1e..efdaa755b6 100644 --- a/src/bundle/Resources/public/js/scripts/admin.notifications.modal.js +++ b/src/bundle/Resources/public/js/scripts/admin.notifications.modal.js @@ -166,12 +166,13 @@ const notificationsTable = modal.querySelector(SELECTOR_TABLE); currentPageLink = notificationsTable.dataset.notifications; + const interval = Number.parseInt(notificationsTable.dataset.notificationsCountInterval, 10) || INTERVAL; modal.querySelectorAll(SELECTOR_MODAL_RESULTS).forEach((link) => link.addEventListener('click', handleModalResultsClick, false)); const getNotificationsStatusLoop = () => { getNotificationsStatus().finally(() => { - global.setTimeout(getNotificationsStatusLoop, INTERVAL); + global.setTimeout(getNotificationsStatusLoop, interval); }); }; diff --git a/src/bundle/Resources/views/themes/admin/account/notifications/list.html.twig b/src/bundle/Resources/views/themes/admin/account/notifications/list.html.twig index 68432761cc..54b684a274 100644 --- a/src/bundle/Resources/views/themes/admin/account/notifications/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/account/notifications/list.html.twig @@ -10,6 +10,7 @@ attr: { 'data-notifications': path('ibexa.notifications.render.page'), 'data-notifications-count': path('ibexa.notifications.count'), + 'data-notifications-count-interval': notifications_count_interval, 'data-notifications-total': pager.nbResults, } } %}