diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-10 00:49:53 +0000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2019-09-10 00:49:53 +0000 |
commit | d7c1af988dd5962e9f1a526a31159ed95d03315d (patch) | |
tree | eefc32e9399ba929c9419eed1120fea68b4556bb | |
parent | 61c7a085ca73dd291a85f0c5204ebc375270e1d9 (diff) | |
parent | 197654fc6a07ab635ea5aed9fe648906953182b8 (diff) | |
download | gitlab-ce-d7c1af988dd5962e9f1a526a31159ed95d03315d.tar.gz |
Merge branch 'issue-67127' into 'master'
Expose :protected field for ../tags/:tag_name API endpoint
See merge request gitlab-org/gitlab-ce!32790
-rw-r--r-- | changelogs/unreleased/issue-67127.yml | 5 | ||||
-rw-r--r-- | doc/api/tags.md | 9 | ||||
-rw-r--r-- | lib/api/entities.rb | 4 | ||||
-rw-r--r-- | spec/fixtures/api/schemas/public_api/v4/tag.json | 3 |
4 files changed, 17 insertions, 4 deletions
diff --git a/changelogs/unreleased/issue-67127.yml b/changelogs/unreleased/issue-67127.yml new file mode 100644 index 00000000000..70848dc6ff9 --- /dev/null +++ b/changelogs/unreleased/issue-67127.yml @@ -0,0 +1,5 @@ +--- +title: Expose 'protected' field for Tag API endpoint. +merge_request: 32790 +author: Andrea Leone +type: added diff --git a/doc/api/tags.md b/doc/api/tags.md index 1d874fea1f8..88f63d6b34b 100644 --- a/doc/api/tags.md +++ b/doc/api/tags.md @@ -46,7 +46,8 @@ Parameters: }, "name": "v1.0.0", "target": "2695effb5807a22ff3d138d593fd856244e155e7", - "message": null + "message": null, + "protected": true } ] ``` @@ -94,7 +95,8 @@ Example Response: "committer_email": "contact@arthurverschaeve.be", "committed_date": "2015-02-01T21:56:31.000+01:00" }, - "release": null + "release": null, + "protected": false } ``` @@ -138,7 +140,8 @@ Parameters: }, "name": "v1.0.0", "target": "2695effb5807a22ff3d138d593fd856244e155e7", - "message": null + "message": null, + "protected": false } ``` diff --git a/lib/api/entities.rb b/lib/api/entities.rb index c9b3483acaf..312c8d5b548 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1312,6 +1312,10 @@ module API options[:project].releases.find_by(tag: repo_tag.name) end # rubocop: enable CodeReuse/ActiveRecord + + expose :protected do |repo_tag, options| + ::ProtectedTag.protected?(options[:project], repo_tag.name) + end end class Runner < Grape::Entity diff --git a/spec/fixtures/api/schemas/public_api/v4/tag.json b/spec/fixtures/api/schemas/public_api/v4/tag.json index 5713ea1f526..bb0190955f0 100644 --- a/spec/fixtures/api/schemas/public_api/v4/tag.json +++ b/spec/fixtures/api/schemas/public_api/v4/tag.json @@ -16,7 +16,8 @@ { "type": "null" }, { "$ref": "release/tag_release.json" } ] - } + }, + "protected": { "type": "boolean" } }, "additionalProperties": false } |