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
Kazuhiko Shiozaki
gitlab-ce
Commits
631a3027
Commit
631a3027
authored
Dec 05, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix API setting of 'public' attribute to false will make a project private
Closes #3864
parent
d2f9a901
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
CHANGELOG
CHANGELOG
+1
-0
lib/api/projects.rb
lib/api/projects.rb
+6
-2
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+12
-0
No files found.
CHANGELOG
View file @
631a3027
Please view this file on the master branch, on stable branches it's out of date.
v 8.3.0 (unreleased)
- Fix API setting of 'public' attribute to false will make a project private (Stan Hu)
- Fix: Assignee selector is empty when 'Unassigned' is selected (Jose Corcuera)
- Fix 500 error when update group member permission
- Trim leading and trailing whitespace of milestone and issueable titles (Jose Corcuera)
...
...
lib/api/projects.rb
View file @
631a3027
...
...
@@ -7,8 +7,12 @@ module API
helpers
do
def
map_public_to_visibility_level
(
attrs
)
publik
=
attrs
.
delete
(
:public
)
publik
=
parse_boolean
(
publik
)
attrs
[
:visibility_level
]
=
Gitlab
::
VisibilityLevel
::
PUBLIC
if
!
attrs
[
:visibility_level
].
present?
&&
publik
==
true
if
publik
.
present?
&&
!
attrs
[
:visibility_level
].
present?
publik
=
parse_boolean
(
publik
)
# Since setting the public attribute to private could mean either
# private or internal, use the more conservative option, private.
attrs
[
:visibility_level
]
=
(
publik
==
true
)
?
Gitlab
::
VisibilityLevel
::
PUBLIC
:
Gitlab
::
VisibilityLevel
::
PRIVATE
end
attrs
end
end
...
...
spec/requests/api/projects_spec.rb
View file @
631a3027
...
...
@@ -742,6 +742,18 @@ describe API::API, api: true do
end
end
it
'should update visibility_level from public to private'
do
project3
.
update_attributes
({
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
})
project_param
=
{
public:
false
}
put
api
(
"/projects/
#{
project3
.
id
}
"
,
user
),
project_param
expect
(
response
.
status
).
to
eq
(
200
)
project_param
.
each_pair
do
|
k
,
v
|
expect
(
json_response
[
k
.
to_s
]).
to
eq
(
v
)
end
expect
(
json_response
[
'visibility_level'
]).
to
eq
(
Gitlab
::
VisibilityLevel
::
PRIVATE
)
end
it
'should not update name to existing name'
do
project_param
=
{
name:
project3
.
name
}
put
api
(
"/projects/
#{
project
.
id
}
"
,
user
),
project_param
...
...
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