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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
636db151
Commit
636db151
authored
Sep 06, 2016
by
Olaf Tomalka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Higher code quality for fork to namespace API
parent
3aa40153
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
6 deletions
+5
-6
CHANGELOG
CHANGELOG
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+0
-1
spec/requests/api/fork_spec.rb
spec/requests/api/fork_spec.rb
+4
-4
No files found.
CHANGELOG
View file @
636db151
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 8.12.0 (unreleased)
v 8.12.0 (unreleased)
- Add abil
lity to fork to a specific namespace using API. @ritave <olaf@tomalka.me>
- Add abil
ity to fork to a specific namespace using API. (ritave)
- Prepend blank line to `Closes` message on merge request linked to issue (lukehowell)
- Prepend blank line to `Closes` message on merge request linked to issue (lukehowell)
- Filter tags by name !6121
- Filter tags by name !6121
- Make push events have equal vertical spacing.
- Make push events have equal vertical spacing.
...
...
lib/api/projects.rb
View file @
636db151
...
@@ -204,7 +204,6 @@ module API
...
@@ -204,7 +204,6 @@ module API
namespace
=
Namespace
.
find_by
(
id:
namespace_id
)
||
Namespace
.
find_by_path_or_name
(
namespace_id
)
namespace
=
Namespace
.
find_by
(
id:
namespace_id
)
||
Namespace
.
find_by_path_or_name
(
namespace_id
)
not_found!
(
'Target Namespace'
)
unless
namespace
not_found!
(
'Target Namespace'
)
unless
namespace
authorize!
:create_projects
,
namespace
attrs
[
:namespace
]
=
namespace
attrs
[
:namespace
]
=
namespace
end
end
...
...
spec/requests/api/fork_spec.rb
View file @
636db151
...
@@ -3,10 +3,10 @@ require 'spec_helper'
...
@@ -3,10 +3,10 @@ require 'spec_helper'
describe
API
::
API
,
api:
true
do
describe
API
::
API
,
api:
true
do
include
ApiHelpers
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
,
username:
'user2_name'
)
}
let
(
:user2
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:user3
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:group
)
{
create
(
:group
,
name:
'group_name'
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:group2
)
do
let
(
:group2
)
do
group
=
create
(
:group
,
name:
'group2_name'
)
group
=
create
(
:group
,
name:
'group2_name'
)
group
.
add_owner
(
user2
)
group
.
add_owner
(
user2
)
...
@@ -94,7 +94,7 @@ describe API::API, api: true do
...
@@ -94,7 +94,7 @@ describe API::API, api: true do
it
'fails if trying to fork to another user when not admin'
do
it
'fails if trying to fork to another user when not admin'
do
post
api
(
"/projects/fork/
#{
project
.
id
}
"
,
user2
),
namespace:
admin
.
namespace
.
id
post
api
(
"/projects/fork/
#{
project
.
id
}
"
,
user2
),
namespace:
admin
.
namespace
.
id
expect
(
response
).
to
have_http_status
(
40
3
)
expect
(
response
).
to
have_http_status
(
40
9
)
end
end
it
'fails if trying to fork to non-existent namespace'
do
it
'fails if trying to fork to non-existent namespace'
do
...
@@ -114,7 +114,7 @@ describe API::API, api: true do
...
@@ -114,7 +114,7 @@ describe API::API, api: true do
it
'fails to fork to not owned group'
do
it
'fails to fork to not owned group'
do
post
api
(
"/projects/fork/
#{
project
.
id
}
"
,
user2
),
namespace:
group
.
name
post
api
(
"/projects/fork/
#{
project
.
id
}
"
,
user2
),
namespace:
group
.
name
expect
(
response
).
to
have_http_status
(
40
3
)
expect
(
response
).
to
have_http_status
(
40
9
)
end
end
it
'forks to not owned group when admin'
do
it
'forks to not owned group when admin'
do
...
...
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