diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-05-12 22:48:09 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-05-12 22:48:09 +0200 |
commit | 0c22698bd4dbe7d0d3e4a6c8bc946ac6f5de1c12 (patch) | |
tree | 775771cbe8f3c16dedebe1f27acadd464c96099e /lib/api/issues.rb | |
parent | 74c69709dc19dbaf56c226b5a7955f229af10f4f (diff) | |
download | gitlab-ce-0c22698bd4dbe7d0d3e4a6c8bc946ac6f5de1c12.tar.gz |
Add API endpoints for un/subscribing from/to a label
Closes #15638
Diffstat (limited to 'lib/api/issues.rb')
-rw-r--r-- | lib/api/issues.rb | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 40928749481..f59a4d6c012 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -103,8 +103,7 @@ module API # Example Request: # GET /projects/:id/issues/:issue_id get ":id/issues/:issue_id" do - @issue = user_project.issues.find(params[:issue_id]) - not_found! unless can?(current_user, :read_issue, @issue) + @issue = find_project_issue(params[:issue_id]) present @issue, with: Entities::Issue, current_user: current_user end @@ -234,42 +233,6 @@ module API authorize!(:destroy_issue, issue) issue.destroy end - - # Subscribes to a project issue - # - # Parameters: - # id (required) - The ID of a project - # issue_id (required) - The ID of a project issue - # Example Request: - # POST /projects/:id/issues/:issue_id/subscription - post ':id/issues/:issue_id/subscription' do - issue = user_project.issues.find(params[:issue_id]) - - if issue.subscribed?(current_user) - not_modified! - else - issue.toggle_subscription(current_user) - present issue, with: Entities::Issue, current_user: current_user - end - end - - # Unsubscribes from a project issue - # - # Parameters: - # id (required) - The ID of a project - # issue_id (required) - The ID of a project issue - # Example Request: - # DELETE /projects/:id/issues/:issue_id/subscription - delete ':id/issues/:issue_id/subscription' do - issue = user_project.issues.find(params[:issue_id]) - - if issue.subscribed?(current_user) - issue.unsubscribe(current_user) - present issue, with: Entities::Issue, current_user: current_user - else - not_modified! - end - end end end end |