message: Bug Check rbac before polling for rules silences
diff: @@ -62,7 +62,7 @@ import {
  splitClusterVersionChannel,
  } from '../module/k8s';
  import { ClusterVersionModel } from '../models';
  -import { useAccessReview } from './utils/rbac';
  +import { useAccessReview, useAccessReview2 } from './utils/rbac';
  import { LinkifyExternal } from './utils';
  import { PrometheusEndpoint } from './graphs/helpers';
  import { LabelSelector } from '@console/internal/module/k8s/label-selector';
  @@ -193,7 +193,13 @@ export const ConnectedNotificationDrawer_: React.FC<ConnectedNotificationDrawerP
  }) => {
  const { t } = useTranslation();
  const dispatch = useDispatch();
  + const [rulesAccess, isRulesAccessLoading] = useAccessReview2({
  + group: 'monitoring.coreos.com',
  + resource: 'prometheusrules',
  + verb: 'list',
  + });
  React.useEffect(() => {
  + if (rulesAccess && isRulesAccessLoading) {
  const poll: NotificationPoll = (url, key: 'notificationAlerts' | 'silences', dataHandler) => {
  dispatch(alertingLoading(key));
  const notificationPoller = (): void => {
  @@ -249,7 +255,8 @@ export const ConnectedNotificationDrawer_: React.FC<ConnectedNotificationDrawerP
  }
  return () => _.each(pollerTimeouts, clearTimeout);
  - }, [dispatch, t]);
  + }
  + }, [dispatch, t, rulesAccess, isRulesAccessLoading]);
  const clusterVersion: ClusterVersionKind = useClusterVersion();
  const [alerts, , loadError] = useNotificationAlerts();
  const alertIds = React.useMemo(() => alerts?.map((alert) => alert.rule.name) || [], [alerts]);
  