Skip to content

Redirect `/-/g/:id` to groups page

Kenneth Chu requested to merge kenneth-redirect-groups-id into master

What does this MR do and why?

Redirect /-/g/:id to groups page, similar to this MR for projects: gitlab-foss!24467 (merged)

I also added a /-/p/:id endpoint for the projects redirect.

Why this MR? I noticed that in our customer notifications, such as our emails to customers after incidents on GitLab.com, we write generic emails that provide Project/Group IDs to customers for privacy reasons, but that makes it hard for users to determine the exact Project/Group. We have instructions to use the API with the IDs, but that is not user friendly. I want to add a more user-friendly redirect that users can use to determine the exact Project/Group affected. It turns out we had such a redirect for Projects, but not for Groups.

Some context behind my decisions:

  • We can't use /groups/:id as the endpoint, because /groups is already used by GitLab to load up a Group page. For example, https://gitlab.com/groups/gitlab-org. If we try to redirect here, there is a conflict to determine if it's a group name or group id to redirect, especially with the group has a name such as 123.
    • /projects/:id doesn't have this issue, because you have to provide the full slug to reach a project (https://gitlab.com/gitlab-org/gitlab).
  • Initial implementation: I used /g/:id as the endpoint, because group names must have a minimum of 2 characters. That means users can't create a group called g to create a conflict here.
    • EDIT: After discussions with the maintainers, I've adjusted this MR to use /-/g/:id as the endpoint, rather than /g/:id.

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.

How to set up and validate locally

  1. Create a private group. Note down the group ID.
  2. As an authenticated user that is a member of the private group, navigate to http://<gitlab_instance>/-/g/<group_id>. You should be redirected to the group page.
  3. As an anonymous user, navigate to http://<gitlab_instance>/-/g/<group_id>. You should be presented with a 404.
Edited by Kenneth Chu

Merge request reports

Loading