diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb index 0570edb51c2..863f50e8e66 100644 --- a/app/controllers/groups/labels_controller.rb +++ b/app/controllers/groups/labels_controller.rb @@ -2,17 +2,16 @@ class Groups::LabelsController < Groups::ApplicationController include ToggleSubscriptionAction before_action :label, only: [:edit, :update, :destroy] - before_action :find_labels, only: [:index] + 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] respond_to :html def index - @labels = @group.labels.page(params[:page]) - respond_to do |format| format.html do + @labels = @group.labels.page(params[:page]) end format.json do render json: LabelSerializer.new.represent_appearance(@available_labels) @@ -107,7 +106,7 @@ class Groups::LabelsController < Groups::ApplicationController session[:previous_labels_path] = URI(request.referer || '').path end - def find_labels + def available_labels @available_labels ||= LabelsFinder.new( current_user, diff --git a/app/views/shared/_label.html.haml b/app/views/shared/_label.html.haml index 6dfa1ffe9b5..15e56b2cad9 100644 --- a/app/views/shared/_label.html.haml +++ b/app/views/shared/_label.html.haml @@ -2,7 +2,7 @@ - status = label_subscription_status(label, @project).inquiry if current_user - subject = local_assigns[:subject] - use_label_priority = local_assigns.fetch(:use_label_priority, false) -- force_priority = local_assigns.fetch(:force_priority, use_label_priority ? label.priority? : false) +- force_priority = local_assigns.fetch(:force_priority, use_label_priority ? label.priority.present? : false) - toggle_subscription_path = toggle_subscription_label_path(label, @project) if current_user - show_label_merge_requests_link = show_label_issuables_link?(label, :merge_requests, project: @project) - show_label_issues_link = show_label_issuables_link?(label, :issues, project: @project) diff --git a/spec/features/projects/labels/update_prioritization_spec.rb b/spec/features/projects/labels/update_prioritization_spec.rb index ae8b1364ec7..9500e3f3311 100644 --- a/spec/features/projects/labels/update_prioritization_spec.rb +++ b/spec/features/projects/labels/update_prioritization_spec.rb @@ -23,8 +23,10 @@ feature 'Prioritize labels' do expect(page).to have_content('Star labels to start sorting by priority') page.within('.other-labels') do + screenshot_and_open_image all('.js-toggle-priority')[1].click wait_for_requests + screenshot_and_open_image expect(page).not_to have_content('feature') end