gitlab-org--gitlab-foss/app/finders/releases_finder.rb
Alessio Caiazza 1ea2d9faa5 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
2018-12-31 12:05:56 +09:00

16 lines
398 B
Ruby

# 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