Skip to content

Limit counts in the super sidebar

What does this MR do and why?

Caps the counts to 99 in the super sidebar's top bar. When the 99 limit is exceeded, we fall back to displaying "99+".

Screenshots or screen recordings

Screenshot_2023-03-29_at_4.40.46_PM

How to set up and validate locally

  1. Enable the new nav:

    1. Enable the feature flag:

      echo "Feature.enable(:super_sidebar_nav)" | rails c
    2. Enable the user setting from the user dropdown:

      Screenshot_2022-12-13_at_1.32.43_PM

  2. If you don't want to mess with actual data in the GDK to hit the 99 limit properly, apply the following patch to force all counts to be a 100:

    diff --git a/app/helpers/sidebars_helper.rb b/app/helpers/sidebars_helper.rb
    index 7e0693a0e7b4..07e42eb66f2d 100644
    --- a/app/helpers/sidebars_helper.rb
    +++ b/app/helpers/sidebars_helper.rb
    @@ -299,6 +299,7 @@ def context_switcher_links
       # We want to avoid printing huge numbers there, so when the count exceeds TOP_BAR_COUNT_LIMIT,
       # we cap it to TOP_BAR_COUNT_LIMIT and append a "+" to it.
       def format_top_bar_count(count)
    +    count = 100
         if count > TOP_BAR_COUNT_LIMIT
           "#{TOP_BAR_COUNT_LIMIT}+"
         else

MR acceptance checklist

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

Related to #399114 (closed)

Merge request reports