Skip to content

Filter out ProjectNamespaces for Namespace children association

charlie ablett requested to merge 341823-cablett-namespace-scopes into master

What does this MR do and why?

Some scopes in Namespaces, particularly around Group/subgroup hierarchies, are called by logic that expects these objects to be Group objects themselves.

This MR filters ProjectNamespace objects from the the children association.

Third bit of #341823 (closed)

Screenshots or screen recordings

n/a

How to set up and validate locally

Given the existing group structure (a parent group with a project and a subgroup as 'siblings') :

graph TD;
    parent_group-->subgroup;
    parent_group-->project;
  1. Create a ProjectNamespace for a project under parent_group and associate it:
  ProjectNamespace.create(project: project, parent: parent_group, visibility_level: project.visibility_level, name: project.name, path: project.path, type: Namespaces::ProjectNamespace.sti_name, owner: nil)

The resulting structure should look like the following:

graph TD;
    parent_group-->project_namespace;
    parent_group-->subgroup;
    project_namespace-->project;
    parent_group-->project;
  1. Call the scope children

    parent_group.children
  2. The result set should not include project_namespace.

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 #341823 (closed)

Edited by charlie ablett

Merge request reports

Loading