Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6038355f
Commit
6038355f
authored
Feb 15, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dz-nested-groups-improvements-3' into 'master'
Nested groups improvements pt 3 See merge request !9227
parents
fea03a73
dcdab2ae
Changes
27
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
103 additions
and
59 deletions
+103
-59
app/assets/javascripts/namespace_select.js
app/assets/javascripts/namespace_select.js
+2
-2
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+1
-1
app/helpers/submodule_helper.rb
app/helpers/submodule_helper.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+2
-2
app/models/project.rb
app/models/project.rb
+17
-11
app/models/project_services/drone_ci_service.rb
app/models/project_services/drone_ci_service.rb
+3
-3
app/services/projects/transfer_service.rb
app/services/projects/transfer_service.rb
+3
-3
app/views/admin/dashboard/index.html.haml
app/views/admin/dashboard/index.html.haml
+1
-1
app/views/admin/projects/index.html.haml
app/views/admin/projects/index.html.haml
+1
-1
app/views/import/base/unauthorized.js.haml
app/views/import/base/unauthorized.js.haml
+1
-1
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+1
-1
app/views/projects/group_links/_index.html.haml
app/views/projects/group_links/_index.html.haml
+1
-1
app/views/projects/pages_domains/show.html.haml
app/views/projects/pages_domains/show.html.haml
+1
-1
app/views/shared/members/_group.html.haml
app/views/shared/members/_group.html.haml
+1
-1
doc/api/namespaces.md
doc/api/namespaces.md
+8
-1
doc/api/projects.md
doc/api/projects.md
+15
-8
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/backup/repository.rb
lib/backup/repository.rb
+1
-1
lib/gitlab/google_code_import/importer.rb
lib/gitlab/google_code_import/importer.rb
+1
-1
lib/gitlab/import_export.rb
lib/gitlab/import_export.rb
+1
-1
lib/gitlab/import_export/importer.rb
lib/gitlab/import_export/importer.rb
+1
-1
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+1
-1
spec/lib/gitlab/import_export/import_export_spec.rb
spec/lib/gitlab/import_export/import_export_spec.rb
+3
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+29
-10
spec/requests/api/namespaces_spec.rb
spec/requests/api/namespaces_spec.rb
+4
-2
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+1
-0
spec/requests/api/v3/projects_spec.rb
spec/requests/api/v3/projects_spec.rb
+1
-0
No files found.
app/assets/javascripts/namespace_select.js
View file @
6038355f
...
...
@@ -29,7 +29,7 @@
if
(
selected
.
id
==
null
)
{
return
selected
.
text
;
}
else
{
return
selected
.
kind
+
"
:
"
+
selected
.
path
;
return
selected
.
kind
+
"
:
"
+
selected
.
full_
path
;
}
},
data
:
function
(
term
,
dataCallback
)
{
...
...
@@ -50,7 +50,7 @@
if
(
namespace
.
id
==
null
)
{
return
namespace
.
text
;
}
else
{
return
namespace
.
kind
+
"
:
"
+
namespace
.
path
;
return
namespace
.
kind
+
"
:
"
+
namespace
.
full_
path
;
}
},
renderRow
:
this
.
renderRow
,
...
...
app/helpers/namespaces_helper.rb
View file @
6038355f
...
...
@@ -10,7 +10,7 @@ module NamespacesHelper
data_attr_users
=
{
'data-options-parent'
=>
'users'
}
group_opts
=
[
"Groups"
,
groups
.
sort_by
(
&
:human_name
).
map
{
|
g
|
[
display_path
?
g
.
path
:
g
.
human_name
,
g
.
id
,
data_attr_group
]
}
"Groups"
,
groups
.
sort_by
(
&
:human_name
).
map
{
|
g
|
[
display_path
?
g
.
full_
path
:
g
.
human_name
,
g
.
id
,
data_attr_group
]
}
]
users_opts
=
[
...
...
app/helpers/submodule_helper.rb
View file @
6038355f
...
...
@@ -63,7 +63,7 @@ module SubmoduleHelper
namespace
=
components
.
pop
.
gsub
(
/^\.\.$/
,
''
)
if
namespace
.
empty?
namespace
=
@project
.
namespace
.
path
namespace
=
@project
.
namespace
.
full_
path
end
[
...
...
app/models/merge_request.rb
View file @
6038355f
...
...
@@ -598,7 +598,7 @@ class MergeRequest < ActiveRecord::Base
def
source_project_namespace
if
source_project
&&
source_project
.
namespace
source_project
.
namespace
.
path
source_project
.
namespace
.
full_
path
else
"(removed)"
end
...
...
@@ -606,7 +606,7 @@ class MergeRequest < ActiveRecord::Base
def
target_project_namespace
if
target_project
&&
target_project
.
namespace
target_project
.
namespace
.
path
target_project
.
namespace
.
full_
path
else
"(removed)"
end
...
...
app/models/project.rb
View file @
6038355f
...
...
@@ -454,7 +454,7 @@ class Project < ActiveRecord::Base
if
forked?
job_id
=
RepositoryForkWorker
.
perform_async
(
id
,
forked_from_project
.
repository_storage_path
,
forked_from_project
.
path_with_namespace
,
self
.
namespace
.
path
)
self
.
namespace
.
full_
path
)
else
job_id
=
RepositoryImportWorker
.
perform_async
(
self
.
id
)
end
...
...
@@ -942,8 +942,8 @@ class Project < ActiveRecord::Base
Gitlab
::
AppLogger
.
info
"Project was renamed:
#{
old_path_with_namespace
}
->
#{
new_path_with_namespace
}
"
Gitlab
::
UploadsTransfer
.
new
.
rename_project
(
path_was
,
path
,
namespace
.
path
)
Gitlab
::
PagesTransfer
.
new
.
rename_project
(
path_was
,
path
,
namespace
.
path
)
Gitlab
::
UploadsTransfer
.
new
.
rename_project
(
path_was
,
path
,
namespace
.
full_
path
)
Gitlab
::
PagesTransfer
.
new
.
rename_project
(
path_was
,
path
,
namespace
.
full_
path
)
end
# Expires various caches before a project is renamed.
...
...
@@ -1150,19 +1150,25 @@ class Project < ActiveRecord::Base
end
def
pages_url
subdomain
,
_
,
url_path
=
full_path
.
partition
(
'/'
)
# The hostname always needs to be in downcased
# All web servers convert hostname to lowercase
host
=
"
#{
namespace
.
path
}
.
#{
Settings
.
pages
.
host
}
"
.
downcase
host
=
"
#{
subdomain
}
.
#{
Settings
.
pages
.
host
}
"
.
downcase
# The host in URL always needs to be downcased
url
=
Gitlab
.
config
.
pages
.
url
.
sub
(
/^https?:\/\//
)
do
|
prefix
|
"
#{
prefix
}#{
namespace
.
path
}
."
"
#{
prefix
}#{
subdomain
}
."
end
.
downcase
# If the project path is the same as host, we serve it as group page
return
url
if
host
==
path
return
url
if
host
==
url_path
"
#{
url
}
/
#{
url_path
}
"
end
"
#{
url
}
/
#{
path
}
"
def
pages_subdomain
full_path
.
partition
(
'/'
).
first
end
def
pages_path
...
...
@@ -1179,8 +1185,8 @@ class Project < ActiveRecord::Base
# 3. We asynchronously remove pages with force
temp_path
=
"
#{
path
}
.
#{
SecureRandom
.
hex
}
.deleted"
if
Gitlab
::
PagesTransfer
.
new
.
rename_project
(
path
,
temp_path
,
namespace
.
path
)
PagesWorker
.
perform_in
(
5
.
minutes
,
:remove
,
namespace
.
path
,
temp_path
)
if
Gitlab
::
PagesTransfer
.
new
.
rename_project
(
path
,
temp_path
,
namespace
.
full_
path
)
PagesWorker
.
perform_in
(
5
.
minutes
,
:remove
,
namespace
.
full_
path
,
temp_path
)
end
end
...
...
@@ -1230,7 +1236,7 @@ class Project < ActiveRecord::Base
end
def
ensure_dir_exist
gitlab_shell
.
add_namespace
(
repository_storage_path
,
namespace
.
path
)
gitlab_shell
.
add_namespace
(
repository_storage_path
,
namespace
.
full_
path
)
end
def
predefined_variables
...
...
@@ -1238,7 +1244,7 @@ class Project < ActiveRecord::Base
{
key:
'CI_PROJECT_ID'
,
value:
id
.
to_s
,
public:
true
},
{
key:
'CI_PROJECT_NAME'
,
value:
path
,
public:
true
},
{
key:
'CI_PROJECT_PATH'
,
value:
path_with_namespace
,
public:
true
},
{
key:
'CI_PROJECT_NAMESPACE'
,
value:
namespace
.
path
,
public:
true
},
{
key:
'CI_PROJECT_NAMESPACE'
,
value:
namespace
.
full_
path
,
public:
true
},
{
key:
'CI_PROJECT_URL'
,
value:
web_url
,
public:
true
}
]
end
...
...
app/models/project_services/drone_ci_service.rb
View file @
6038355f
...
...
@@ -12,7 +12,7 @@ class DroneCiService < CiService
def
compose_service_hook
hook
=
service_hook
||
build_service_hook
# If using a service template, project may not be available
hook
.
url
=
[
drone_url
,
"/api/hook"
,
"?owner=
#{
project
.
namespace
.
path
}
"
,
"&name=
#{
project
.
path
}
"
,
"&access_token=
#{
token
}
"
].
join
if
project
hook
.
url
=
[
drone_url
,
"/api/hook"
,
"?owner=
#{
project
.
namespace
.
full_
path
}
"
,
"&name=
#{
project
.
path
}
"
,
"&access_token=
#{
token
}
"
].
join
if
project
hook
.
enable_ssl_verification
=
!!
enable_ssl_verification
hook
.
save
end
...
...
@@ -38,7 +38,7 @@ class DroneCiService < CiService
def
commit_status_path
(
sha
,
ref
)
url
=
[
drone_url
,
"gitlab/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/commits/
#{
sha
}
"
,
"gitlab/
#{
project
.
full_
path
}
/commits/
#{
sha
}
"
,
"?branch=
#{
URI
::
encode
(
ref
.
to_s
)
}
&access_token=
#{
token
}
"
]
URI
.
join
(
*
url
).
to_s
...
...
@@ -73,7 +73,7 @@ class DroneCiService < CiService
def
build_page
(
sha
,
ref
)
url
=
[
drone_url
,
"gitlab/
#{
project
.
namespace
.
path
}
/
#{
project
.
path
}
/redirect/commits/
#{
sha
}
"
,
"gitlab/
#{
project
.
full_
path
}
/redirect/commits/
#{
sha
}
"
,
"?branch=
#{
URI
::
encode
(
ref
.
to_s
)
}
"
]
URI
.
join
(
*
url
).
to_s
...
...
app/services/projects/transfer_service.rb
View file @
6038355f
...
...
@@ -30,7 +30,7 @@ module Projects
Project
.
transaction
do
old_path
=
project
.
path_with_namespace
old_group
=
project
.
group
new_path
=
File
.
join
(
new_namespace
.
try
(
:path
)
||
''
,
project
.
path
)
new_path
=
File
.
join
(
new_namespace
.
try
(
:
full_
path
)
||
''
,
project
.
path
)
if
Project
.
where
(
path:
project
.
path
,
namespace_id:
new_namespace
.
try
(
:id
)).
present?
raise
TransferError
.
new
(
"Project with same path in target namespace already exists"
)
...
...
@@ -63,10 +63,10 @@ module Projects
Labels
::
TransferService
.
new
(
current_user
,
old_group
,
project
).
execute
# Move uploads
Gitlab
::
UploadsTransfer
.
new
.
move_project
(
project
.
path
,
old_namespace
.
path
,
new_namespace
.
path
)
Gitlab
::
UploadsTransfer
.
new
.
move_project
(
project
.
path
,
old_namespace
.
full_path
,
new_namespace
.
full_
path
)
# Move pages
Gitlab
::
PagesTransfer
.
new
.
move_project
(
project
.
path
,
old_namespace
.
path
,
new_namespace
.
path
)
Gitlab
::
PagesTransfer
.
new
.
move_project
(
project
.
path
,
old_namespace
.
full_path
,
new_namespace
.
full_
path
)
project
.
old_path_with_namespace
=
old_path
...
...
app/views/admin/dashboard/index.html.haml
View file @
6038355f
...
...
@@ -163,6 +163,6 @@
-
@groups
.
each
do
|
group
|
%p
=
link_to
[
:admin
,
group
],
class:
'str-truncated-60'
do
=
group
.
name
=
group
.
full_
name
%span
.light.pull-right
#{
time_ago_with_tooltip
(
group
.
created_at
)
}
app/views/admin/projects/index.html.haml
View file @
6038355f
...
...
@@ -30,7 +30,7 @@
-
toggle_text
=
'Namespace'
-
if
params
[
:namespace_id
].
present?
-
namespace
=
Namespace
.
find
(
params
[
:namespace_id
])
-
toggle_text
=
"
#{
namespace
.
kind
}
:
#{
namespace
.
path
}
"
-
toggle_text
=
"
#{
namespace
.
kind
}
:
#{
namespace
.
full_
path
}
"
=
dropdown_toggle
(
toggle_text
,
{
toggle:
'dropdown'
},
{
toggle_class:
'js-namespace-select large'
})
.dropdown-menu.dropdown-select.dropdown-menu-align-right
=
dropdown_title
(
'Namespaces'
)
...
...
app/views/import/base/unauthorized.js.haml
View file @
6038355f
...
...
@@ -4,7 +4,7 @@
import_button = tr.find(".btn-import")
origin_target = target_field.text()
project_name = "
#{
@project_name
}
"
origin_namespace = "
#{
@target_namespace
.
path
}
"
origin_namespace = "
#{
@target_namespace
.
full_
path
}
"
target_field.empty()
target_field.append("<p class='alert alert-danger'>This namespace has already been taken! Please choose another one.</p>")
target_field.append("<input type='text' name='target_namespace' />")
...
...
app/views/projects/edit.html.haml
View file @
6038355f
...
...
@@ -232,7 +232,7 @@
.form-group
.input-group
.input-group-addon
#{
URI
.
join
(
root_url
,
@project
.
namespace
.
path
)
}
/
#{
URI
.
join
(
root_url
,
@project
.
namespace
.
full_
path
)
}
/
=
f
.
text_field
:path
,
class:
'form-control'
%ul
%li
Be careful. Renaming a project's repository can have unintended side effects.
...
...
app/views/projects/group_links/_index.html.haml
View file @
6038355f
...
...
@@ -39,7 +39,7 @@
=
icon
(
"folder-open-o"
,
class:
"settings-list-icon"
)
.pull-left
=
link_to
group
do
=
group
.
name
=
group
.
full_
name
%br
up to
#{
group_link
.
human_access
}
-
if
group_link
.
expires?
...
...
app/views/projects/pages_domains/show.html.haml
View file @
6038355f
...
...
@@ -17,7 +17,7 @@
%p
To access the domain create a new DNS record:
%pre
#{
@domain
.
domain
}
CNAME
#{
@domain
.
project
.
namespace
.
path
}
.
#{
Settings
.
pages
.
host
}
.
#{
@domain
.
domain
}
CNAME
#{
@domain
.
project
.
pages_subdomain
}
.
#{
Settings
.
pages
.
host
}
.
%tr
%td
Certificate
...
...
app/views/shared/members/_group.html.haml
View file @
6038355f
...
...
@@ -6,7 +6,7 @@
%span
.list-item-name
=
image_tag
group_icon
(
group
),
class:
"avatar s40"
,
alt:
''
%strong
=
link_to
group
.
name
,
group_path
(
group
)
=
link_to
group
.
full_
name
,
group_path
(
group
)
.cgray
Joined
#{
time_ago_with_tooltip
(
group
.
created_at
)
}
-
if
group_link
.
expires?
...
...
doc/api/namespaces.md
View file @
6038355f
...
...
@@ -35,6 +35,12 @@ Example response:
"id"
:
2
,
"path"
:
"group1"
,
"kind"
:
"group"
},
{
"id"
:
3
,
"path"
:
"bar"
,
"kind"
:
"group"
,
"full_path"
:
"foo/bar"
,
}
]
```
...
...
@@ -64,7 +70,8 @@ Example response:
{
"id"
:
4
,
"path"
:
"twitter"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"twitter"
,
}
]
```
doc/api/projects.md
View file @
6038355f
...
...
@@ -77,7 +77,8 @@ Parameters:
"id"
:
3
,
"name"
:
"Diaspora"
,
"path"
:
"diaspora"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"diaspora"
},
"archived"
:
false
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/4/uploads/avatar.png"
,
...
...
@@ -127,7 +128,8 @@ Parameters:
"id"
:
4
,
"name"
:
"Brightbox"
,
"path"
:
"brightbox"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"brightbox"
},
"permissions"
:
{
"project_access"
:
{
...
...
@@ -207,7 +209,8 @@ Parameters:
"id"
:
3
,
"name"
:
"Diaspora"
,
"path"
:
"diaspora"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"diaspora"
},
"permissions"
:
{
"project_access"
:
{
...
...
@@ -585,7 +588,8 @@ Example response:
"id"
:
3
,
"name"
:
"Diaspora"
,
"path"
:
"diaspora"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"diaspora"
},
"archived"
:
true
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
...
...
@@ -650,7 +654,8 @@ Example response:
"id"
:
3
,
"name"
:
"Diaspora"
,
"path"
:
"diaspora"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"diaspora"
},
"archived"
:
true
,
"avatar_url"
:
"http://example.com/uploads/project/avatar/3/uploads/avatar.png"
,
...
...
@@ -721,7 +726,8 @@ Example response:
"id"
:
3
,
"name"
:
"Diaspora"
,
"path"
:
"diaspora"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"diaspora"
},
"permissions"
:
{
"project_access"
:
{
...
...
@@ -803,7 +809,8 @@ Example response:
"id"
:
3
,
"name"
:
"Diaspora"
,
"path"
:
"diaspora"
,
"kind"
:
"group"
"kind"
:
"group"
,
"full_path"
:
"diaspora"
},
"permissions"
:
{
"project_access"
:
{
...
...
lib/api/entities.rb
View file @
6038355f
...
...
@@ -414,7 +414,7 @@ module API
end
class
Namespace
<
Grape
::
Entity
expose
:id
,
:name
,
:path
,
:kind
expose
:id
,
:name
,
:path
,
:kind
,
:full_path
end
class
MemberAccess
<
Grape
::
Entity
...
...
lib/backup/repository.rb
View file @
6038355f
...
...
@@ -12,7 +12,7 @@ module Backup
path_to_project_bundle
=
path_to_bundle
(
project
)
# Create namespace dir if missing
FileUtils
.
mkdir_p
(
File
.
join
(
backup_repos_path
,
project
.
namespace
.
path
))
if
project
.
namespace
FileUtils
.
mkdir_p
(
File
.
join
(
backup_repos_path
,
project
.
namespace
.
full_
path
))
if
project
.
namespace
if
project
.
empty_repo?
$progress
.
puts
"[SKIPPED]"
.
color
(
:cyan
)
...
...
lib/gitlab/google_code_import/importer.rb
View file @
6038355f
...
...
@@ -310,7 +310,7 @@ module Gitlab
if
name
==
project
.
import_source
"#
#{
id
}
"
else
"
#{
project
.
namespace
.
path
}
/
#{
name
}
#
#{
id
}
"
"
#{
project
.
namespace
.
full_
path
}
/
#{
name
}
#
#{
id
}
"
end
text
=
"~~
#{
text
}
~~"
if
deleted
text
...
...
lib/gitlab/import_export.rb
View file @
6038355f
...
...
@@ -35,7 +35,7 @@ module Gitlab
end
def
export_filename
(
project
:)
basename
=
"
#{
Time
.
now
.
strftime
(
'%Y-%m-%d_%H-%M-%3N'
)
}
_
#{
project
.
namespace
.
path
}
_
#{
project
.
path
}
"
basename
=
"
#{
Time
.
now
.
strftime
(
'%Y-%m-%d_%H-%M-%3N'
)
}
_
#{
project
.
namespace
.
full_
path
}
_
#{
project
.
path
}
"
"
#{
basename
[
0
..
FILENAME_LIMIT
]
}
_export.tar.gz"
end
...
...
lib/gitlab/import_export/importer.rb
View file @
6038355f
...
...
@@ -56,7 +56,7 @@ module Gitlab
end
def
path_with_namespace
File
.
join
(
@project
.
namespace
.
path
,
@project
.
path
)
File
.
join
(
@project
.
namespace
.
full_
path
,
@project
.
path
)
end
def
repo_path
...
...
lib/gitlab/shell.rb
View file @
6038355f
...
...
@@ -172,7 +172,7 @@ module Gitlab
# add_namespace("/path/to/storage", "gitlab")
#
def
add_namespace
(
storage
,
name
)
FileUtils
.
mkdir
(
full_path
(
storage
,
name
),
mode:
0770
)
unless
exists?
(
storage
,
name
)
FileUtils
.
mkdir
_p
(
full_path
(
storage
,
name
),
mode:
0770
)
unless
exists?
(
storage
,
name
)
end
# Remove directory from repositories storage
...
...
spec/lib/gitlab/import_export/import_export_spec.rb
View file @
6038355f
...
...
@@ -2,14 +2,15 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
,
services:
true
do
describe
'export filename'
do
let
(
:project
)
{
create
(
:empty_project
,
:public
,
path:
'project-path'
)
}
let
(
:group
)
{
create
(
:group
,
:nested
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
,
path:
'project-path'
,
namespace:
group
)
}
it
'contains the project path'
do
expect
(
described_class
.
export_filename
(
project:
project
)).
to
include
(
project
.
path
)
end
it
'contains the namespace path'
do
expect
(
described_class
.
export_filename
(
project:
project
)).
to
include
(
project
.
namespace
.
path
)
expect
(
described_class
.
export_filename
(
project:
project
)).
to
include
(
project
.
namespace
.
full_
path
)
end
it
'does not go over a certain length'
do
...
...
spec/models/project_spec.rb
View file @
6038355f
...
...
@@ -1852,8 +1852,8 @@ describe Project, models: true do
end
describe
'#pages_url'
do
let
(
:group
)
{
create
:group
,
name:
group_name
}
let
(
:
project
)
{
create
:empty_project
,
namespace:
group
,
name:
project_name
}
let
(
:group
)
{
create
:group
,
name:
'Group'
}
let
(
:
nested_group
)
{
create
:group
,
parent:
group
}
let
(
:domain
)
{
'Example.com'
}
subject
{
project
.
pages_url
}
...
...
@@ -1863,18 +1863,37 @@ describe Project, models: true do
allow
(
Gitlab
.
config
.
pages
).
to
receive
(
:url
).
and_return
(
'http://example.com'
)
end
context
'top-level group'
do
let
(
:project
)
{
create
:empty_project
,
namespace:
group
,
name:
project_name
}
context
'group page'
do
let
(
:group_name
)
{
'Group'
}
let
(
:project_name
)
{
'group.example.com'
}
it
{
is_expected
.
to
eq
(
"http://group.example.com"
)
}
end
context
'project page'
do
let
(
:group_name
)
{
'Group'
}
let
(
:project_name
)
{
'Project'
}
it
{
is_expected
.
to
eq
(
"http://group.example.com/project"
)
}
end
end
context
'nested group'
do
let
(
:project
)
{
create
:empty_project
,
namespace:
nested_group
,
name:
project_name
}
let
(
:expected_url
)
{
"http://group.example.com/
#{
nested_group
.
path
}
/
#{
project
.
path
}
"
}
context
'group page'
do
let
(
:project_name
)
{
'group.example.com'
}
it
{
is_expected
.
to
eq
(
expected_url
)
}
end
context
'project page'
do
let
(
:project_name
)
{
'Project'
}
it
{
is_expected
.
to
eq
(
expected_url
)
}
end
end
end
end
spec/requests/api/namespaces_spec.rb
View file @
6038355f
...
...
@@ -5,7 +5,7 @@ describe API::Namespaces, api: true do
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:group1
)
{
create
(
:group
)
}
let!
(
:group2
)
{
create
(
:group
)
}
let!
(
:group2
)
{
create
(
:group
,
:nested
)
}
describe
"GET /namespaces"
do
context
"when unauthenticated"
do
...
...
@@ -25,11 +25,13 @@ describe API::Namespaces, api: true do
end
it
"admin: returns an array of matched namespaces"
do
get
api
(
"/namespaces?search=
#{
group
1
.
name
}
"
,
admin
)
get
api
(
"/namespaces?search=
#{
group
2
.
name
}
"
,
admin
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
last
[
'path'
]).
to
eq
(
group2
.
path
)
expect
(
json_response
.
last
[
'full_path'
]).
to
eq
(
group2
.
full_path
)
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
6038355f
...
...
@@ -585,6 +585,7 @@ describe API::Projects, api: true do
'name'
=>
user
.
namespace
.
name
,
'path'
=>
user
.
namespace
.
path
,
'kind'
=>
user
.
namespace
.
kind
,
'full_path'
=>
user
.
namespace
.
full_path
,
})
end
...
...
spec/requests/api/v3/projects_spec.rb
View file @
6038355f
...
...
@@ -682,6 +682,7 @@ describe API::V3::Projects, api: true do
'name'
=>
user
.
namespace
.
name
,
'path'
=>
user
.
namespace
.
path
,
'kind'
=>
user
.
namespace
.
kind
,
'full_path'
=>
user
.
namespace
.
full_path
,
})
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment