diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-01-11 15:34:29 +0100 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-01-11 15:34:29 +0100 |
commit | a30377c6f1415a863bd40d1876e3cf4c46bb9f5d (patch) | |
tree | 338a7ae15e34d4ae65adb2717f53998e12b58f34 /lib/api | |
parent | 4e70f2519bba83d5f9d6fd0bed80e9837e8b5fc5 (diff) | |
parent | 1ede18bfa84a47ade94a0fe1acd246233db02693 (diff) | |
download | gitlab-ce-a30377c6f1415a863bd40d1876e3cf4c46bb9f5d.tar.gz |
Merge branch 'master' into ci/api-builds
* master: (143 commits)
Only load autocomplete data when actually needed
Check for current user
Add pencil icon to edit group settings
Issue #5817 wording of the web hooks updated on issue and merge events
use JavaScript instead of CoffeeScript in Views, the reason #9819
Before project save ensure that a runners_token exists
Fix Error 500 when visiting build page of project with nil runners_token
Remove outdated gitlab-git-http-server reference from Install doc
Fix typo in build page of projects
Update docs for shared runner default settings
Disable "Already Blocked" button in admin abuse report page
Add CHANGELOG entry for reply-by-email fix
Use WOFF versions of SourceSansPro
Clean up document on adding users to a project
Refactor ZenMode
Fix caching issue where build status was not updating in project dashboard
Add a CHANGELOG entry for The Most Important Feature of All Time(TM)
changes verb `references` to noun `reference`.
fixes new branch button positioning, when visible and not visible container
DRY up upload and download services
...
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/merge_requests.rb | 2 | ||||
-rw-r--r-- | lib/api/projects.rb | 12 | ||||
-rw-r--r-- | lib/api/tags.rb | 21 | ||||
-rw-r--r-- | lib/api/users.rb | 2 |
4 files changed, 34 insertions, 3 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 3c1c6bda260..5c97fe1c88c 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -211,7 +211,7 @@ module API unauthorized! unless merge_request.can_be_merged_by?(current_user) not_allowed! if !merge_request.open? || merge_request.work_in_progress? - merge_request.check_if_can_be_merged if merge_request.unchecked? + merge_request.check_if_can_be_merged render_api_error!('Branch cannot be merged', 406) unless merge_request.can_be_merged? diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 0781236cf6d..8b1390e3289 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -269,7 +269,7 @@ module API # Remove a forked_from relationship # # Parameters: - # id: (required) - The ID of the project being marked as a fork + # id: (required) - The ID of the project being marked as a fork # Example Request: # DELETE /projects/:id/fork delete ":id/fork" do @@ -278,6 +278,16 @@ module API user_project.forked_project_link.destroy end end + + # Upload a file + # + # Parameters: + # id: (required) - The ID of the project + # file: (required) - The file to be uploaded + post ":id/uploads" do + ::Projects::UploadService.new(user_project, params[:file]).execute + end + # search for projects current_user has access to # # Parameters: diff --git a/lib/api/tags.rb b/lib/api/tags.rb index 47621f443e6..2d8a9e51bb9 100644 --- a/lib/api/tags.rb +++ b/lib/api/tags.rb @@ -40,6 +40,27 @@ module API end end + # Delete tag + # + # Parameters: + # id (required) - The ID of a project + # tag_name (required) - The name of the tag + # Example Request: + # DELETE /projects/:id/repository/tags/:tag + delete ":id/repository/tags/:tag_name", requirements: { tag_name: /.*/ } do + authorize_push_project + result = DeleteTagService.new(user_project, current_user). + execute(params[:tag_name]) + + if result[:status] == :success + { + tag_name: params[:tag_name] + } + else + render_api_error!(result[:message], result[:return_code]) + end + end + # Add release notes to tag # # Parameters: diff --git a/lib/api/users.rb b/lib/api/users.rb index 3400f0713ef..0d7813428e2 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -39,7 +39,7 @@ module API if current_user.is_admin? present @user, with: Entities::UserFull else - present @user, with: Entities::UserBasic + present @user, with: Entities::User end end |