Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-04-12 19:52:43 +0300
committerRobert Schilling <rschilling@student.tugraz.at>2016-04-13 15:26:41 +0300
commit3ab9ea8dae1edc6ab8c8563843342890736eb24c (patch)
treeca7d663b5f6761db6973101338bf8c5fb8a838e6 /lib
parentea2193aaeb1127746dc78d2dda7037d998911662 (diff)
Make staring API more restful
Diffstat (limited to 'lib')
-rw-r--r--lib/api/projects.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index ebcf7a4eedd..c7fdfbfe57b 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -279,13 +279,12 @@ module API
# Example Request:
# POST /projects/:id/star
post ':id/star' do
- if !current_user.starred?(user_project)
+ if current_user.starred?(user_project)
+ not_modified!
+ else
current_user.toggle_star(user_project)
user_project.reload
present user_project, with: Entities::Project
-
- else
- not_modified!
end
end
@@ -294,8 +293,8 @@ module API
# Parameters:
# id (required) - The ID of a project
# Example Request:
- # POST /projects/:id/unstar
- post ':id/unstar' do
+ # DELETE /projects/:id/unstar
+ delete ':id/star' do
if current_user.starred?(user_project)
current_user.toggle_star(user_project)
user_project.reload