Introduce fork_namespace entity and serializer
What does this MR do?
This MR introduces fork_namespace entity and serializer which will be consumed by fork controller to provide required data in JSON format to new fork page (related issue: #212456 (closed))
Main integration MR: !35592 (merged)
Desired output format from controller:
{ "namespaces": [{
"id": 22,
"name": "Gitlab Org",
"description": "Ad et ipsam earum id aut nobis.",
"visibility": "public",
"full_name": "Gitlab Org",
"created_at": "2020-06-22T03:32:05.664Z",
"updated_at": "2020-06-22T03:32:05.664Z",
"avatar_url": null,
"fork_path": "/twitter/typeahead-js/-/forks?namespace_key=22",
"forked_project_path": null,
"permission": "Owner",
"relative_path": "/gitlab-org",
"markdown_description": "<p data-sourcepos=\"1:1-1:31\" dir=\"auto\">Ad et ipsam earum id aut nobis.</p>",
"can_create_project": true,
"marked_for_deletion": false
}]}
Important fields:
-
fork_path
- path to fork project to namespaces -
forked_project_path
- path to existing fork in namespace
This serializer will be consumed in fork controller in following way:
respond_to do |format|
# ... skipped ...
format.json do
namespaces = fork_service.valid_fork_targets - [current_user.namespace, project.namespace]
render json: {
namespaces: ForkNamespaceSerializer.new.represent(namespaces, project: project, current_user: current_user)
}
end
end
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
- [-] Code review guidelines
-
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Edited by Ethan Urie