Skip to content

Resolve ""Show issues/merge requests assigned to me" is not working (v3)"

Tomas Vik requested to merge 202-fix-fetch-user into master

This MR fixes the broken fetchUser method.

The problem

There has been a change to the gitlab_service.fetch() method. Instead of directly returning the parsed JSON body, we are returning { response, headers } object. (commit diff)

This change broke the fetchUser method because the method was expecting the fetch() method to directly return user response.

The solution

The first commit of this MR only fixes the interface mismatch and instead of user = await fetch() we use const {response} = await fetch().

The second commit refactors the fetchUser() method into two distinct methods fetchCurrentUser() and fetchFirstUserByUsername() these methods represent distinct paths trhough the original parametrized method. Only fetchCurrentUser() needs to be exported out of the module.

Testing

I tested all usages of the fetchCurrentUser() and fetchFirstUserByUsername() methods.

  1. fetchCurrentUser()
    • test by calling the "Show issues assigned to me" and "Show merge requests assigned to me" commands
  2. fetchFirstUserByUsername()
    • this needs to be tested by having a custom query for merge request that contains assignee and author properties.
    • The one I used:
    "gitlab.customQueries": [
      {
        "name": "Closed MRs assigned to me",
        "type": "merge_requests",
        "scope": "assigned_to_me",
        "noItemText": "There is no issue assigned to you.",
        "state": "closed",
        "author": "viktomas"
      },
      {
        "name": "Merged MRs assigned to me",
        "type": "merge_requests",
        "scope": "assigned_to_me",
        "noItemText": "There is no issue assigned to you.",
        "state": "merged",
        "assignee": "viktomas"
      }
    ]

Closes #202 (closed)

Edited by Roman Kuba

Merge request reports