summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2016-04-13 15:42:33 -0300
committerFelipe Artur <felipefac@gmail.com>2016-04-13 15:42:33 -0300
commit5395e6175e77d3cd8800bb9f41c09d59934b502f (patch)
tree2234488f40eb4f7aa6920fbe2ab41b1d6f53e14e /lib/api/projects.rb
parent39d853f5bd9492fa8dfc8e07ec11070705d3c879 (diff)
parentc0678f2d281242601560e2646cab1aa8a349c4bb (diff)
downloadgitlab-ce-5395e6175e77d3cd8800bb9f41c09d59934b502f.tar.gz
Merge branch 'master' into issue_3508issue_3508
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 24b31005475..cc2c7a0c503 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -272,6 +272,40 @@ module API
present user_project, with: Entities::Project
end
+ # Star project
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # Example Request:
+ # POST /projects/:id/star
+ post ':id/star' do
+ if current_user.starred?(user_project)
+ not_modified!
+ else
+ current_user.toggle_star(user_project)
+ user_project.reload
+
+ present user_project, with: Entities::Project
+ end
+ end
+
+ # Unstar project
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # Example Request:
+ # DELETE /projects/:id/star
+ delete ':id/star' do
+ if current_user.starred?(user_project)
+ current_user.toggle_star(user_project)
+ user_project.reload
+
+ present user_project, with: Entities::Project
+ else
+ not_modified!
+ end
+ end
+
# Remove project
#
# Parameters: