Skip to content

Update ReferenceRewriter to handle projects and groups

What does this MR do and why?

Changes in this MR are intended to allow ReferenceRewriter to rewrite references in the markdown content while the content is being moved across different namespaces.

Previously we only had "move/clone issue" functionality. Issues used to be a project level only item. Now as we transition to WorkItem we also have group level work items, e.g. Epic Work Item, and in order to keep parity on "move" functionality we need to be able to also move group level WorkItems(Issues). So this MR adapts the ReferenceRewriter to handle references in markdown when items are moved across groups and projects.

As part of this improvement I had to also change the IssueReferenceFilter so that it does not passes on group level items, in order for all group level items to be handled as Work Item, but WorkItemReferenceFilter. Otherwise if references are detected by IssueReferenceFilter those are not being picked up by WorkItemReferenceFilter.

For spec coverage I have converted existing spec/lib/gitlab/gfm/reference_rewriter_spec.rb to ee/spec/lib/gitlab/gfm/reference_rewriter_spec.rb in order to be able to create group level work items as group level work items are EE feature. The EE spec cover cases of rewrite across Projects, ProjectNamespaces and Groups.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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.

Screenshots or screen recordings

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

Before After

How to set up and validate locally

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

Edited by Alexandru Croitor

Merge request reports

Loading