Skip to content

Fixed label groups subscription API to be consistent with the WebUI

Lucas Zampieri requested to merge lzampier/gitlab:group_label_api_fix into master

What does this MR do?

Labels groups subscription API on search is returning subscribed false even on subscribed label.
The code added is based on the code used on the WebUI in label_subscription_status().
The issue can be reproduced on labels?search=:label_id and on labels/:label_id.

Added tests to cover the search aspect of both the project and group label APIs.

Conformity

Availability and Testing

The labels below were used for testing and a subscription to each of them was made via web UI, tests realized against 25bf1.

Group label: Project label:
Id: 41 Title: Ambalt Id: 44 Title: Aquapod
curl -sH "$COM_GITLAB_TOKEN" "$GITLAB_URL/api/v4/groups/26/labels?search=Ambalt" | jq
[
  {
    "id": 41,
    "name": "Ambalt",
    "color": "#41d16d",
    "description": null,
    "description_html": "",
    "text_color": "#FFFFFF",
    "subscribed": false
  }
]
curl -sH "$COM_GITLAB_TOKEN" "$GITLAB_URL/api/v4/projects/6/labels?search=Aquapod" | jq
[
  {
    "id": 44,
    "name": "Aquapod",
    "color": "#1e840e",
    "description": null,
    "description_html": "",
    "text_color": "#FFFFFF",
    "subscribed": true,
    "priority": null,
    "is_project_label": false
  }
]

Merge request reports