diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2018-12-13 14:08:53 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-12-31 06:05:56 +0300 |
commit | 1ea2d9faa518f6b769b05a71a1f93b4ea0226bc1 (patch) | |
tree | 291cd8d7a6c6113e75219dc873e24fb414df119d /app/finders/releases_finder.rb | |
parent | c07bf1abf2a5c3751e575ee5926e9a052fa0b341 (diff) |
Add releases API
This commit introduces Releases API under /api/v4/projects/:id/releases
* We are introducing release policies at project level.
* We are deprecating releases changes from tags, both api and web
interface.
* Tags::CreateService no longer create a release
This feature is controlled by :releases_page feature flag
Diffstat (limited to 'app/finders/releases_finder.rb')
-rw-r--r-- | app/finders/releases_finder.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/finders/releases_finder.rb b/app/finders/releases_finder.rb new file mode 100644 index 00000000000..c185f77afa2 --- /dev/null +++ b/app/finders/releases_finder.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class ReleasesFinder + def initialize(project, current_user = nil) + @project = project + @current_user = current_user + end + + # rubocop: disable CodeReuse/ActiveRecord + def execute + return [] unless Ability.allowed?(@current_user, :read_release, @project) + + @project.releases.order('created_at DESC') + end + # rubocop: enable CodeReuse/ActiveRecord +end |