Fix gfm reference for namespaces with the same path
What does this MR do and why?
Fix gfm reference for namespaces with the same path
When we create a system note reference when an issue gets mentioned in an epic, we created a relative reference, like "mentioned in gitlab#X".
However, when the group and the issue have the same namespace path name, it was an ambigious reference because the reference parser is looking first to resolve namespace paths within the current parent namespace.
In the example above, when there is a group and a project called
gitlab
, we'd create the system note on the gitlab
project with
mentioned in gitlab#X
. When looking up a namespace with the
name gitlab
in the parent group of the issue, we'd find the group and
would reference some issue that has the IID 123.
This is not correct, since we wanted to reference the group level issue/work item.
By generating an absolute reference in the case above
mentioned in /gitlab#X
we remove the ambiguity as the reference
parser can find the correct group work item.
Changelog: fixed EE: true
References
- Issue #487375
Screenshots or screen recordings
Before | After |
---|---|
before_same_path | after_same_path |
How to set up and validate locally
- Create a group and project that have the same name, e.g. Group:
gitlab
, and projectgitlab
- Create an epic in the group
- Create an issue in the group
- Mention the issue in the epic with
#:iid
- Go to the mentioned issue, and check the system note that includes the mention
- Before: It doesn't link to the epic but the issue again
- After: It links to the epic
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.