Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-2888

hideTab(String) hides the wrong tab if an earlier tab has been hidden by Jira itself



    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 5.3.26
    • Fix Version/s: 5.4.27
    • Component/s: Behaviours
    • Labels:
    • Critical Points:


      To reproduce:

      • Create an issue screen with multiple tabs, such that one tab - which is not the last tab on the screen - contains only the field 'Security Level'.
      • Ensure that the user you're logged in as doesn't have permission to set issue security.
      • Create a behaviour, applicable to the same issue type(s) as the multi-tab issue screen, which uses hideTab(String) in its initialiser to hide - by name - one of the tabs following the Security Level tab.
      • Open the multi-tab issue screen (e.g. by creating an issue of an appropriate type).

      Expected result: The tab whose name was supplied to hideTab is hidden.

      Actual result: The next tab along (if there is one) is hidden instead.

      What happens behind the scenes is the following:

      • You don't have permission to set issue security, so Jira doesn't show you the Security Level field. Because it's the only field on its tab, Jira doesn't show you that tab either. It achieves this by simply not sending any of the tab's content to be rendered on the the front end - from the UI's perspective, the tab doesn't exist.
      • When you call hideTab(String), Behaviours converts this into a call to hideTab(int) by fetching the list of tabs from the Jira backend and finding the numerical index of the named tab within that list. hideTab(int) then instructs the Behaviours front-end JS to hide the tab with that index.
      • The list of tabs provided by the Jira backend is complete - it doesn't account for user permissions - so the Security Level tab is included despite being entirely absent in the UI. Therefore the indices of any subsequent tabs will be calculated as one larger than their actual index on the front end.

      We could probably do some filtering using something like FieldScreenLayoutItem#isShown, to bring the list we get back from the Jira backend in line with what the UI displays: unfortunately it doesn't seem as though the Jira API provides a convenient isShown-like method at the tab level.




            ahasan Ashraful Hasan [X] (Inactive)
            jchoules Joanna Choules
            0 Vote for this issue
            3 Start watching this issue