Skip to content

Remove query dependencies between Issues and Service Desk lists

What does this MR do and why?

I originally intended to extract shared queries for Issues and Service Desk list. However, after some thought I ended up with:

  1. Assignees: there was already searchProjectMembers in ~/graphql_shared directory. So I decided to use this one, instead of the one that was defined in Issues list.
  2. Labels & Milestones: queries from Issues list are design in a way to specify if group or project data should be fetched. As Service Desk is bound to a project and not to a group, I decided to only fetch data for the project. Which means these queries differ significantly and can be defined for Service Desk exclusively.

Screenshots or screen recordings

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

Query for assignees search token

[
  {
    "data": {
      "project": {
        "id": "gid://gitlab/Project/6",
        "projectMembers": {
          "nodes": [
            {
              "id": "gid://gitlab/ProjectMember/54",
              "user": {
                "id": "gid://gitlab/User/21",
                "avatarUrl": "https://www.gravatar.com/avatar/bd811adb9d039532354000b3fa8cfb6a?s=80&d=identicon",
                "name": "Kaci Sipes",
                "username": "willow",
                "__typename": "UserCore"
              },
              "__typename": "ProjectMember"
            },
            {
              "id": "gid://gitlab/ProjectMember/53",
              "user": {
                "id": "gid://gitlab/User/20",
                "avatarUrl": "https://www.gravatar.com/avatar/81f479ac3c8f7df58504fdce8fb095f2?s=80&d=identicon",
                "name": "Drew Erdman",
                "username": "adaline",
                "__typename": "UserCore"
              },
              "__typename": "ProjectMember"
            },
            {
              "id": "gid://gitlab/ProjectMember/52",
              "user": {
                "id": "gid://gitlab/User/14",
                "avatarUrl": "https://www.gravatar.com/avatar/d30b943742002771b64a0dfd6520047a?s=80&d=identicon",
                "name": "Tami Rice",
                "username": "brittaney_bechtelar",
                "__typename": "UserCore"
              },
              "__typename": "ProjectMember"
            },
            {
              "id": "gid://gitlab/GroupMember/26",
              "user": {
                "id": "gid://gitlab/User/17",
                "avatarUrl": "https://www.gravatar.com/avatar/4eff66937e0aed43466520caa1cb79b7?s=80&d=identicon",
                "name": "Pricilla Miller",
                "username": "louanne_franecki",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            },
            {
              "id": "gid://gitlab/GroupMember/25",
              "user": {
                "id": "gid://gitlab/User/9",
                "avatarUrl": "https://www.gravatar.com/avatar/4f433a498dbcc03297ddbf61b24489db?s=80&d=identicon",
                "name": "Rick Cartwright",
                "username": "buffy_donnelly",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            },
            {
              "id": "gid://gitlab/GroupMember/24",
              "user": {
                "id": "gid://gitlab/User/8",
                "avatarUrl": "https://www.gravatar.com/avatar/b47aaa0683f4e458d727175bc16d84ed?s=80&d=identicon",
                "name": "Gregg Rempel",
                "username": "sebastian_veum",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            },
            {
              "id": "gid://gitlab/GroupMember/23",
              "user": {
                "id": "gid://gitlab/User/5",
                "avatarUrl": "https://www.gravatar.com/avatar/95a988ad9aedf4a237a2da2e9b542d15?s=80&d=identicon",
                "name": "Emil Little",
                "username": "vince",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            },
            {
              "id": "gid://gitlab/GroupMember/5",
              "user": {
                "id": "gid://gitlab/User/1",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "name": "Administrator",
                "username": "root",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            }
          ],
          "__typename": "MemberInterfaceConnection"
        },
        "__typename": "Project"
      }
    }
  }
]
searchUsers (before)
[
  {
    "data": {
      "project": {
        "id": "gid://gitlab/Project/6",
        "projectMembers": {
          "nodes": [
            {
              "id": "gid://gitlab/ProjectMember/54",
              "user": {
                "id": "gid://gitlab/User/21",
                "name": "Kaci Sipes",
                "username": "willow",
                "avatarUrl": "https://www.gravatar.com/avatar/bd811adb9d039532354000b3fa8cfb6a?s=80&d=identicon",
                "__typename": "UserCore"
              },
              "__typename": "ProjectMember"
            },
            {
              "id": "gid://gitlab/ProjectMember/53",
              "user": {
                "id": "gid://gitlab/User/20",
                "name": "Drew Erdman",
                "username": "adaline",
                "avatarUrl": "https://www.gravatar.com/avatar/81f479ac3c8f7df58504fdce8fb095f2?s=80&d=identicon",
                "__typename": "UserCore"
              },
              "__typename": "ProjectMember"
            },
            {
              "id": "gid://gitlab/ProjectMember/52",
              "user": {
                "id": "gid://gitlab/User/14",
                "name": "Tami Rice",
                "username": "brittaney_bechtelar",
                "avatarUrl": "https://www.gravatar.com/avatar/d30b943742002771b64a0dfd6520047a?s=80&d=identicon",
                "__typename": "UserCore"
              },
              "__typename": "ProjectMember"
            },
            {
              "id": "gid://gitlab/GroupMember/26",
              "user": {
                "id": "gid://gitlab/User/17",
                "name": "Pricilla Miller",
                "username": "louanne_franecki",
                "avatarUrl": "https://www.gravatar.com/avatar/4eff66937e0aed43466520caa1cb79b7?s=80&d=identicon",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            },
            {
              "id": "gid://gitlab/GroupMember/25",
              "user": {
                "id": "gid://gitlab/User/9",
                "name": "Rick Cartwright",
                "username": "buffy_donnelly",
                "avatarUrl": "https://www.gravatar.com/avatar/4f433a498dbcc03297ddbf61b24489db?s=80&d=identicon",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            },
            {
              "id": "gid://gitlab/GroupMember/24",
              "user": {
                "id": "gid://gitlab/User/8",
                "name": "Gregg Rempel",
                "username": "sebastian_veum",
                "avatarUrl": "https://www.gravatar.com/avatar/b47aaa0683f4e458d727175bc16d84ed?s=80&d=identicon",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            },
            {
              "id": "gid://gitlab/GroupMember/23",
              "user": {
                "id": "gid://gitlab/User/5",
                "name": "Emil Little",
                "username": "vince",
                "avatarUrl": "https://www.gravatar.com/avatar/95a988ad9aedf4a237a2da2e9b542d15?s=80&d=identicon",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            },
            {
              "id": "gid://gitlab/GroupMember/5",
              "user": {
                "id": "gid://gitlab/User/1",
                "name": "Administrator",
                "username": "root",
                "avatarUrl": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
                "__typename": "UserCore"
              },
              "__typename": "GroupMember"
            }
          ],
          "__typename": "MemberInterfaceConnection"
        },
        "__typename": "Project"
      }
    }
  }
]
searchProjectMembers (after)

Query for labels search token

[
  {
    "data": {
      "project": {
        "id": "gid://gitlab/Project/6",
        "labels": {
          "nodes": [
            {
              "id": "gid://gitlab/ProjectLabel/97",
              "color": "#a5c6fb",
              "textColor": "#1F1E24",
              "title": "Accent",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/46",
              "color": "#4c101f",
              "textColor": "#FFFFFF",
              "title": "Brunceforge",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/45",
              "color": "#c7bdfd",
              "textColor": "#1F1E24",
              "title": "CCY",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/ProjectLabel/96",
              "color": "#400a4b",
              "textColor": "#FFFFFF",
              "title": "Grand Marquis",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/ProjectLabel/95",
              "color": "#f3709a",
              "textColor": "#FFFFFF",
              "title": "Jetta",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/48",
              "color": "#112b02",
              "textColor": "#FFFFFF",
              "title": "KJG",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/44",
              "color": "#f1bded",
              "textColor": "#1F1E24",
              "title": "Paph",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/43",
              "color": "#7055cf",
              "textColor": "#FFFFFF",
              "title": "Pheneforge",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/40",
              "color": "#44808e",
              "textColor": "#FFFFFF",
              "title": "Phore",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/47",
              "color": "#dfb8e7",
              "textColor": "#1F1E24",
              "title": "Reubalt",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/ProjectLabel/98",
              "color": "#852f60",
              "textColor": "#FFFFFF",
              "title": "Santa Fe",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/41",
              "color": "#c84f9b",
              "textColor": "#FFFFFF",
              "title": "Sirpod",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/42",
              "color": "#74406a",
              "textColor": "#FFFFFF",
              "title": "Tribalt",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/ProjectLabel/94",
              "color": "#c0d394",
              "textColor": "#1F1E24",
              "title": "Villager",
              "__typename": "Label"
            }
          ]
        },
        "__typename": "Project"
      }
    }
  }
]
searchLabels (before)
[
  {
    "data": {
      "project": {
        "id": "gid://gitlab/Project/6",
        "labels": {
          "nodes": [
            {
              "id": "gid://gitlab/ProjectLabel/97",
              "color": "#a5c6fb",
              "textColor": "#1F1E24",
              "title": "Accent",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/46",
              "color": "#4c101f",
              "textColor": "#FFFFFF",
              "title": "Brunceforge",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/45",
              "color": "#c7bdfd",
              "textColor": "#1F1E24",
              "title": "CCY",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/ProjectLabel/96",
              "color": "#400a4b",
              "textColor": "#FFFFFF",
              "title": "Grand Marquis",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/ProjectLabel/95",
              "color": "#f3709a",
              "textColor": "#FFFFFF",
              "title": "Jetta",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/48",
              "color": "#112b02",
              "textColor": "#FFFFFF",
              "title": "KJG",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/44",
              "color": "#f1bded",
              "textColor": "#1F1E24",
              "title": "Paph",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/43",
              "color": "#7055cf",
              "textColor": "#FFFFFF",
              "title": "Pheneforge",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/40",
              "color": "#44808e",
              "textColor": "#FFFFFF",
              "title": "Phore",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/47",
              "color": "#dfb8e7",
              "textColor": "#1F1E24",
              "title": "Reubalt",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/ProjectLabel/98",
              "color": "#852f60",
              "textColor": "#FFFFFF",
              "title": "Santa Fe",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/41",
              "color": "#c84f9b",
              "textColor": "#FFFFFF",
              "title": "Sirpod",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/GroupLabel/42",
              "color": "#74406a",
              "textColor": "#FFFFFF",
              "title": "Tribalt",
              "__typename": "Label"
            },
            {
              "id": "gid://gitlab/ProjectLabel/94",
              "color": "#c0d394",
              "textColor": "#1F1E24",
              "title": "Villager",
              "__typename": "Label"
            }
          ]
        },
        "__typename": "Project"
      }
    }
  }
]
searchProjectLabels (after)

Query for milestones search token

[
  {
    "data": {
      "project": {
        "id": "gid://gitlab/Project/6",
        "milestones": {
          "nodes": [
            {
              "id": "gid://gitlab/Milestone/29",
              "title": "v3.0",
              "__typename": "Milestone"
            },
            {
              "id": "gid://gitlab/Milestone/27",
              "title": "v1.0",
              "__typename": "Milestone"
            },
            {
              "id": "gid://gitlab/Milestone/26",
              "title": "v0.0",
              "__typename": "Milestone"
            },
            {
              "id": "gid://gitlab/Milestone/50",
              "title": "Sprint - Placeat fugiat libero porro eum molestias ratione aut repudiandae.",
              "__typename": "Milestone"
            }
          ],
          "__typename": "MilestoneConnection"
        },
        "__typename": "Project"
      }
    }
  }
]
searchMilestones (before)
[
  {
    "data": {
      "project": {
        "id": "gid://gitlab/Project/6",
        "milestones": {
          "nodes": [
            {
              "id": "gid://gitlab/Milestone/29",
              "title": "v3.0",
              "__typename": "Milestone"
            },
            {
              "id": "gid://gitlab/Milestone/27",
              "title": "v1.0",
              "__typename": "Milestone"
            },
            {
              "id": "gid://gitlab/Milestone/26",
              "title": "v0.0",
              "__typename": "Milestone"
            },
            {
              "id": "gid://gitlab/Milestone/50",
              "title": "Sprint - Placeat fugiat libero porro eum molestias ratione aut repudiandae.",
              "__typename": "Milestone"
            }
          ],
          "__typename": "MilestoneConnection"
        },
        "__typename": "Project"
      }
    }
  }
]
searchProjectMilestones (after)

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

SERVICE DESK SETUP

  1. Setup a service desk on your GDK: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/service_desk_mail_room.md
  2. Send an email to your Service Desk, so you have something to display on the list.

ALTERNATIVE SETUP

  1. You can omit Service Desk setup and force an already existing issue to become a SD issue. Open the rails console: rails c
  2. Use these commands. Change 7 to the project id that matches the one you want to use for testing:
email = 'your-email@gitlab.com'
project = Project.find 7
issue = project.issues.last
issue.update!(service_desk_reply_to: email, author: User.support_bot)
IssueEmailParticipant.create!(issue: issue, email: email)
  1. In rails console enable the feature flag

    Feature.enable(:service_desk_vue_list)
    Feature.enable(:frontend_caching)
  2. Visit the project that has Service Desk setup

  3. In the main navigation click Monitor, than Service Desk.

  4. Click within the search bar and start choosing tokens, you can check queries with GraphQL Network plugin. Data should fetch, no errors in the console should appear.

FYI There is a known problem that Issues in the main navigation highlight when you are on Service Desk view.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #418920 (closed)

Edited by Paulina Sedlak-Jakubowska

Merge request reports