BigW Consortium Gitlab

Commit 18fc7c66 by Robert Speicher

Merge branch 'fix/14418' into 'master'

Dedupe labels in labels selector in Dashboard pages Fixes #14418. See merge request !3311
parents c7901078 733ae587
......@@ -21,17 +21,24 @@ class DashboardController < Dashboard::ApplicationController
end
def labels
labels = Label.where(project_id: @projects).select(:title, :color).uniq(:title)
respond_to do |format|
format.json do
render json: view_context.projects_labels_options
render json: labels
end
end
end
def milestones
milestones = Milestone.where(project_id: @projects).active
epoch = DateTime.parse('1970-01-01')
grouped_milestones = GlobalMilestone.build_collection(milestones)
grouped_milestones = grouped_milestones.sort_by { |x| x.due_date.nil? ? epoch : x.due_date }
respond_to do |format|
format.json do
render json: view_context.projects_milestones_options
render json: grouped_milestones
end
end
end
......
......@@ -109,14 +109,6 @@ module LabelsHelper
end
end
def projects_labels_options
if @project
@project.labels
else
Label.where(project_id: @projects)
end
end
def labels_filter_path
if @project
namespace_project_labels_path(@project.namespace, @project, :json)
......
......@@ -46,19 +46,6 @@ module MilestonesHelper
end
end
def projects_milestones_options
milestones =
if @project
@project.milestones
else
Milestone.where(project_id: @projects)
end.active
epoch = DateTime.parse('1970-01-01')
grouped_milestones = GlobalMilestone.build_collection(milestones)
grouped_milestones.sort_by { |x| x.due_date.nil? ? epoch : x.due_date }
end
def milestones_filter_dropdown_path
if @project
namespace_project_milestones_path(@project.namespace, @project, :json)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment