Skip to content

Commit

Permalink
Get getNotificationsStatusLoop interval from YAML config
Browse files Browse the repository at this point in the history
  • Loading branch information
adriendupuis committed Mar 5, 2024
1 parent ea0e96a commit 230f163
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/bundle/Controller/NotificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
} %}
Expand Down

0 comments on commit 230f163

Please sign in to comment.