FilterBean always calculates number of sharedUsers

XMLWordPrintable

    • 7.02
    • 1
    • Severity 2 - Major

      Summary

      FilterBean has an expandable field sharedUsers. It calculates total size of this collection even if the field isn't expanded.
      It causes unnecessary memory pressure. (i.e. JRASERVER-65930) and extra DB load (i.e. JRASERVER-65892)
      Documentation page: REST-7.6.4-filter-getFavouriteFilters

      Steps to Reproduce

      • Create a filter
      • Share it with some user group
      • Do REST API call /rest/api/2/filter/favourite

      Expected Results

      sharedUsers have size=0

      Actual Results

      sharedUsers have calculated size

      Workaround

      • Set dark feature com.atlassian.jira.rest.v2.search.UserListResolver.getShareCount.disabled flag, that will always return sharedUsers.size: 0 in JSON response, eg:
        sharedUsers: {
         size: 0,
         items: [ ],
         max-results: 1000,
         start-index: 0,
         end-index: 0
        },
        
        • API break. Since after change /rest/api/2/filter/favourite API doesn't return a correct number of the share count there is a risk that it will affect some other functionality.

      Details on fix

      • Implementation:
        • /rest/api/2/filter/favourite API doesn't return size of sharedUsers collection, when it is not expanded (default)
        • enableSharedUsers parameters is removed. Previous description: enableSharedUsers (boolean) Default: true - enable calculating shared users collection
      • Reasoning: Such behavior was never described in the API, so it's not breakage.
      • If you were relying on this behaviour, you need to adapt your code: you need to expand sharedUsers in your request.
        • I.e.: <jira_url>/rest/api/2/filter/favourite?expand=sharedUsers[0]

            Assignee:
            Ilya Zinoviev (Inactive)
            Reporter:
            Ilya Zinoviev (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: