Skip to content

Ensure item_id of navigation menu_items is unique within each different panel

Lukas Eipert requested to merge leipert-super-sidebar-spec into master

What does this MR do and why?

Add specs which check for unique menu item item_id

We need a unique item_id for each menu item for three purposes:

  1. QA Specs. Clicking menu items by their item id might be helpful
  2. Pinning items feature. Pinning menu items inside Groups / Project menus uses the item_id to save which items a user has pinned
  3. Telemetry. We measure clicks in the navigation and if two menu items share the same ID, we cannot differentiate it in our telemetry data

Unique ids for merge request menu items

The following used to have :merge_request as their id:

  • Project > Analyze > Merge request analytics (:merge_request_analytics)
  • Project > Settings > Merge requests (:merge_request_settings)

Ensure uniqueness of more menu item ids

  • ee/lib/ee/sidebars/admin/menus/admin_settings_menu.rb: Minor copy-paste error between two menu item ids.
  • lib/sidebars/admin/menus/monitoring_menu.rb: Background Migrations clearly had the wrong menu id with usage_trends and is now using background_migrations
  • lib/sidebars/projects/super_sidebar_menus/operations_menu.rb: Accidental copy paste error, because :activity is part of the Manage Menu and not the Operations Menu

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Run the specs 😄
  2. Also pin: Settings > Merge Requests in a project and see that it is now pinned correctly (#407139 (closed))

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Lukas Eipert

Merge request reports