Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-09-07 22:55:48 +0300
committerStan Hu <stanhu@gmail.com>2018-09-07 22:55:48 +0300
commitc0fafb6bb1b54acd0c5def073c468d98a15c4232 (patch)
tree9b31c89193d7a1a1d392d21f8c7d61467ba059f7 /app
parentc155ddd7513a5fcfa93008b7320a3a57e3650343 (diff)
parent534f8152c6405db515172a19ec3df35af4606fa4 (diff)
Merge branch 'dz-refactor-group-labels-finder' into 'master'
Fix group labels page timeout if many projects and labels Closes #51221 See merge request gitlab-org/gitlab-ce!21594
Diffstat (limited to 'app')
-rw-r--r--app/controllers/groups/labels_controller.rb7
-rw-r--r--app/models/label.rb1
2 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb
index 3e0076ac935..e95123c0933 100644
--- a/app/controllers/groups/labels_controller.rb
+++ b/app/controllers/groups/labels_controller.rb
@@ -2,7 +2,6 @@ class Groups::LabelsController < Groups::ApplicationController
include ToggleSubscriptionAction
before_action :label, only: [:edit, :update, :destroy]
- before_action :available_labels, only: [:index]
before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy]
before_action :save_previous_label_path, only: [:edit]
@@ -11,10 +10,12 @@ class Groups::LabelsController < Groups::ApplicationController
def index
respond_to do |format|
format.html do
- @labels = @available_labels.page(params[:page])
+ @labels = @group.labels
+ .optionally_search(params[:search])
+ .page(params[:page])
end
format.json do
- render json: LabelSerializer.new.represent_appearance(@available_labels)
+ render json: LabelSerializer.new.represent_appearance(available_labels)
end
end
end
diff --git a/app/models/label.rb b/app/models/label.rb
index 96c1515b41a..8db7c3abd10 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -5,6 +5,7 @@ class Label < ActiveRecord::Base
include Referable
include Subscribable
include Gitlab::SQL::Pattern
+ include OptionallySearch
# Represents a "No Label" state used for filtering Issues and Merge
# Requests that have no label assigned.