Disabling project features should hide their respective analytics options

Summary

When the repository features are disabled under a project, the Analytics area on its sidebar continues to show Merge Request Analytics.

Likewise, when the issue features are disabled, the Issue Analytics link continues to appear.

Steps to reproduce

  1. Create a project
  2. Under Project > Settings > General > Project features section, disable the Repository and Issues features entirely
  3. Check the Project > Analytics sidebar and Merge Request and Issues options continue to exist when they should not

Example Project

https://gitlab.com/gitlab-silver/hchouraria/subgroup-1-with-projects/secondary-subgroup/a-project-with-issues

(From https://about.gitlab.com/handbook/support/training/training_module_saas_basics.html#places-to-reproduce)

What is the current bug behavior?

Disabling project features does not hide its corresponding analytics links

What is the expected correct behavior?

Disabling project features must hide its corresponding analytics links

Relevant logs and/or screenshots

image

Output of checks

This bug happens on GitLab.com

Possible fixes

A security-related fix recently addressed this (perhaps indirectly) for the Repository analytics link via c0ae3f6a that implicitly now checks if rule repository_disabled is applied through the check of policy download_code.

A similar feature-checking fix to the policies in https://gitlab.com/gitlab-org/gitlab/blob/14c1e9e9d5468ace4bf050c9a54904336f8c6c5c/ee/lib/ee/sidebars/projects/menus/analytics_menu.rb#L67-75 can be made to ensure they respond to the Project feature setting changes.

Related to #345001