diff --git a/app/controllers/labels_controller.rb b/app/controllers/labels_controller.rb index 3cbbb8692e01ca37822d8c85f49186d1d966fe4c..999351e22df601760823a86bc358bdaecb878932 100644 --- a/app/controllers/labels_controller.rb +++ b/app/controllers/labels_controller.rb @@ -7,7 +7,7 @@ class LabelsController < ProjectResourceController respond_to :js, :html def index - @labels = @project.issues.tag_counts_on(:labels).order('count DESC') + @labels = @project.issues_labels.order('count DESC') end protected diff --git a/app/models/project.rb b/app/models/project.rb index f4d868874b90ca32ccf5cbbf93f8941a56080f0b..3ae15f24b1f0007f05707e8e4b0eedc2a3883b6e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -159,6 +159,10 @@ class Project < ActiveRecord::Base def project_id self.id end + + def issues_labels + issues.tag_counts_on(:labels) + end end # == Schema Information diff --git a/app/roles/issue_commonality.rb b/app/roles/issue_commonality.rb index b21d92a30838f5069a8f9ad07ae8b92fafa32914..4aee916c03c7591879161c1f1a56752b999efb89 100644 --- a/app/roles/issue_commonality.rb +++ b/app/roles/issue_commonality.rb @@ -1,4 +1,5 @@ -# Contains common functionality shared between Issues and MergeRequests +# Contains common functionality +# shared between Issues and MergeRequests module IssueCommonality extend ActiveSupport::Concern