releases_finder.rb 303 Bytes
Newer Older
Alessio Caiazza's avatar
Alessio Caiazza committed
1 2 3 4 5 6 7 8 9
# frozen_string_literal: true

class ReleasesFinder
  def initialize(project, current_user = nil)
    @project = project
    @current_user = current_user
  end

  def execute
10
    return Release.none unless Ability.allowed?(@current_user, :read_release, @project)
Alessio Caiazza's avatar
Alessio Caiazza committed
11

12
    @project.releases.sorted
Alessio Caiazza's avatar
Alessio Caiazza committed
13 14
  end
end