diff options
author | Rémy Coutable <remy@rymai.me> | 2016-04-13 10:55:12 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-04-13 10:55:12 +0000 |
commit | 861e685e1853d45dea83bc1d06ebd639b120f36c (patch) | |
tree | 46c58b4993ef054cc314924341c68e5bc0b3c9ad /lib | |
parent | 94c8fbc9fc7588596ecc6395a50f41e9d6d1a557 (diff) | |
parent | fdbf3682023a2ed647c625ec0609dac3227218b2 (diff) | |
download | gitlab-ce-861e685e1853d45dea83bc1d06ebd639b120f36c.tar.gz |
Merge branch 'api-move-issues' into 'master'
API: Ability to move an issue
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/14741
See merge request !3593
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/issues.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index c4ea05ee6cf..850e99981ff 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -195,6 +195,29 @@ module API end end + # Move an existing issue + # + # Parameters: + # id (required) - The ID of a project + # issue_id (required) - The ID of a project issue + # to_project_id (required) - The ID of the new project + # Example Request: + # POST /projects/:id/issues/:issue_id/move + post ':id/issues/:issue_id/move' do + required_attributes! [:to_project_id] + + issue = user_project.issues.find(params[:issue_id]) + new_project = Project.find(params[:to_project_id]) + + begin + issue = ::Issues::MoveService.new(user_project, current_user).execute(issue, new_project) + present issue, with: Entities::Issue, current_user: current_user + rescue ::Issues::MoveService::MoveError => error + render_api_error!(error.message, 400) + end + end + + # # Delete a project issue # # Parameters: |