summaryrefslogtreecommitdiff
path: root/lib/api/merge_requests.rb
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-04-12 14:46:59 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2016-04-13 13:52:13 +0200
commitfa3009095fbb995550a20e5d0cbc994f4290fbea (patch)
tree99dc2ad7c4f3f7afa9a980622df786d24866774b /lib/api/merge_requests.rb
parentf875189b3962bde6e4b7b8c4ffdd18af83cbc922 (diff)
downloadgitlab-ce-fa3009095fbb995550a20e5d0cbc994f4290fbea.tar.gz
Make subscription API more RESTful
Diffstat (limited to 'lib/api/merge_requests.rb')
-rw-r--r--lib/api/merge_requests.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index d166484ba54..7e78609ecb9 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -334,15 +334,15 @@ module API
# id (required) - The ID of a project
# merge_request_id (required) - The ID of a merge request
# Example Request:
- # POST /projects/:id/issues/:merge_request_id/subscribe
- post "#{path}/subscribe" do
+ # POST /projects/:id/issues/:merge_request_id/subscription
+ post "#{path}/subscription" do
merge_request = user_project.merge_requests.find(params[:merge_request_id])
- if !merge_request.subscribed?(current_user)
+ if merge_request.subscribed?(current_user)
+ not_modified!
+ else
merge_request.toggle_subscription(current_user)
present merge_request, with: Entities::MergeRequest, current_user: current_user
- else
- not_modified!
end
end
@@ -352,8 +352,8 @@ module API
# id (required) - The ID of a project
# merge_request_id (required) - The ID of a merge request
# Example Request:
- # POST /projects/:id/merge_requests/:merge_request_id/unsubscribe
- post "#{path}/unsubscribe" do
+ # DELETE /projects/:id/merge_requests/:merge_request_id/subscription
+ delete "#{path}/subscription" do
merge_request = user_project.merge_requests.find(params[:merge_request_id])
if merge_request.subscribed?(current_user)