summaryrefslogtreecommitdiff
path: root/app/finders/releases_finder.rb
blob: c185f77afa299d655ec364800da4f939785f2ec0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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