Merge requests API: fix cache for "with_labels_details" argument

What does this MR do and why?

Contributes to #386784 (closed)

Problem

Merge requests API endpoint uses cache, but the cache refresh doesn't trigger when the user provides with_labels_details argument.

Solution

Add with_labels_details argument value into the cache key. It will create a new version of the cache when the user passes with_labels_details.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screenshot_2024-09-27_at_14.22.40 Screenshot_2024-09-27_at_14.24.35

How to set up and validate locally

  1. Find or create a project with merge requests
  2. Add labels to a merge request
  3. Visit http://gdk.test:3000/api/v4/projects/<project_id>/merge_requests
  4. You should see labels field to contain a list of strings.
  5. Visit http://gdk.test:3000/api/v4/projects/<project_id>/merge_requests?with_labels_details=true
  6. You should see labels field to contain with a list of hashes.
Edited by Vasilii Iakliushin

Merge request reports

Loading