debian-mirror-gitlab/app/finders/releases_finder.rb
2019-12-26 22:10:19 +05:30

16 lines
387 B
Ruby

# frozen_string_literal: true
class ReleasesFinder
def initialize(project, current_user = nil)
@project = project
@current_user = current_user
end
def execute(preload: true)
return Release.none unless Ability.allowed?(@current_user, :read_release, @project)
releases = @project.releases
releases = releases.preloaded if preload
releases.sorted
end
end