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
Boxiang Sun
gitlab-ce
Commits
54231aa4
Commit
54231aa4
authored
Apr 13, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Styling changes to code and docs
parent
3ab9ea8d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
9 deletions
+8
-9
doc/api/projects.md
doc/api/projects.md
+0
-1
lib/api/helpers.rb
lib/api/helpers.rb
+1
-1
lib/api/projects.rb
lib/api/projects.rb
+3
-1
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+4
-6
No files found.
doc/api/projects.md
View file @
54231aa4
...
@@ -617,7 +617,6 @@ Example response:
...
@@ -617,7 +617,6 @@ Example response:
}
}
```
```
### Archive a project
### Archive a project
Archives the project if the user is either admin or the project owner of this project. This action is
Archives the project if the user is either admin or the project owner of this project. This action is
...
...
lib/api/helpers.rb
View file @
54231aa4
...
@@ -242,7 +242,7 @@ module API
...
@@ -242,7 +242,7 @@ module API
end
end
def
not_modified!
def
not_modified!
render_api_error!
(
'304 Not
m
odified'
,
304
)
render_api_error!
(
'304 Not
M
odified'
,
304
)
end
end
def
render_validation_error!
(
model
)
def
render_validation_error!
(
model
)
...
...
lib/api/projects.rb
View file @
54231aa4
...
@@ -284,6 +284,7 @@ module API
...
@@ -284,6 +284,7 @@ module API
else
else
current_user
.
toggle_star
(
user_project
)
current_user
.
toggle_star
(
user_project
)
user_project
.
reload
user_project
.
reload
present
user_project
,
with:
Entities
::
Project
present
user_project
,
with:
Entities
::
Project
end
end
end
end
...
@@ -293,11 +294,12 @@ module API
...
@@ -293,11 +294,12 @@ module API
# Parameters:
# Parameters:
# id (required) - The ID of a project
# id (required) - The ID of a project
# Example Request:
# Example Request:
# DELETE /projects/:id/
un
star
# DELETE /projects/:id/star
delete
':id/star'
do
delete
':id/star'
do
if
current_user
.
starred?
(
user_project
)
if
current_user
.
starred?
(
user_project
)
current_user
.
toggle_star
(
user_project
)
current_user
.
toggle_star
(
user_project
)
user_project
.
reload
user_project
.
reload
present
user_project
,
with:
Entities
::
Project
present
user_project
,
with:
Entities
::
Project
else
else
not_modified!
not_modified!
...
...
spec/requests/api/projects_spec.rb
View file @
54231aa4
...
@@ -1023,7 +1023,7 @@ describe API::API, api: true do
...
@@ -1023,7 +1023,7 @@ describe API::API, api: true do
describe
'POST /projects/:id/star'
do
describe
'POST /projects/:id/star'
do
context
'on an unstarred project'
do
context
'on an unstarred project'
do
it
'stars the project'
do
it
'stars the project'
do
post
api
(
"/projects/
#{
project
.
id
}
/star"
,
user
)
expect
{
post
api
(
"/projects/
#{
project
.
id
}
/star"
,
user
)
}.
to
change
{
project
.
reload
.
star_count
}.
by
(
1
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'star_count'
]).
to
eq
(
1
)
expect
(
json_response
[
'star_count'
]).
to
eq
(
1
)
...
@@ -1037,10 +1037,9 @@ describe API::API, api: true do
...
@@ -1037,10 +1037,9 @@ describe API::API, api: true do
end
end
it
'does not modify the star count'
do
it
'does not modify the star count'
do
post
api
(
"/projects/
#{
project
.
id
}
/star"
,
user
)
expect
{
post
api
(
"/projects/
#{
project
.
id
}
/star"
,
user
)
}.
not_to
change
{
project
.
reload
.
star_count
}
expect
(
response
.
status
).
to
eq
(
304
)
expect
(
response
.
status
).
to
eq
(
304
)
expect
(
project
.
star_count
).
to
eq
(
1
)
end
end
end
end
end
end
...
@@ -1053,7 +1052,7 @@ describe API::API, api: true do
...
@@ -1053,7 +1052,7 @@ describe API::API, api: true do
end
end
it
'unstars the project'
do
it
'unstars the project'
do
delete
api
(
"/projects/
#{
project
.
id
}
/star"
,
user
)
expect
{
delete
api
(
"/projects/
#{
project
.
id
}
/star"
,
user
)
}.
to
change
{
project
.
reload
.
star_count
}.
by
(
-
1
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'star_count'
]).
to
eq
(
0
)
expect
(
json_response
[
'star_count'
]).
to
eq
(
0
)
...
@@ -1062,10 +1061,9 @@ describe API::API, api: true do
...
@@ -1062,10 +1061,9 @@ describe API::API, api: true do
context
'on an unstarred project'
do
context
'on an unstarred project'
do
it
'does not modify the star count'
do
it
'does not modify the star count'
do
delete
api
(
"/projects/
#{
project
.
id
}
/star"
,
user
)
expect
{
delete
api
(
"/projects/
#{
project
.
id
}
/star"
,
user
)
}.
not_to
change
{
project
.
reload
.
star_count
}
expect
(
response
.
status
).
to
eq
(
304
)
expect
(
response
.
status
).
to
eq
(
304
)
expect
(
project
.
star_count
).
to
eq
(
0
)
end
end
end
end
end
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