summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard/labels_controller.rb
blob: b661efa12c0f37a1184cc18e43f7a62acf2cd7a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class Dashboard::LabelsController < Dashboard::ApplicationController
  feature_category :issue_tracking

  def index
    respond_to do |format|
      format.json { render json: LabelSerializer.new.represent_appearance(labels) }
    end
  end

  def labels
    finder_params = { project_ids: projects.select(:id) }

    LabelsFinder.new(current_user, finder_params).execute
      .select('DISTINCT ON (labels.title) labels.*')
  end
end