Commit c896ae7b authored by Luke Bennett's avatar Luke Bennett

BE review

parent d400c94e
...@@ -2,17 +2,16 @@ class Groups::LabelsController < Groups::ApplicationController ...@@ -2,17 +2,16 @@ class Groups::LabelsController < Groups::ApplicationController
include ToggleSubscriptionAction include ToggleSubscriptionAction
before_action :label, only: [:edit, :update, :destroy] 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 :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy]
before_action :save_previous_label_path, only: [:edit] before_action :save_previous_label_path, only: [:edit]
respond_to :html respond_to :html
def index def index
@labels = @group.labels.page(params[:page])
respond_to do |format| respond_to do |format|
format.html do format.html do
@labels = @group.labels.page(params[:page])
end end
format.json do format.json do
render json: LabelSerializer.new.represent_appearance(@available_labels) render json: LabelSerializer.new.represent_appearance(@available_labels)
...@@ -107,7 +106,7 @@ class Groups::LabelsController < Groups::ApplicationController ...@@ -107,7 +106,7 @@ class Groups::LabelsController < Groups::ApplicationController
session[:previous_labels_path] = URI(request.referer || '').path session[:previous_labels_path] = URI(request.referer || '').path
end end
def find_labels def available_labels
@available_labels ||= @available_labels ||=
LabelsFinder.new( LabelsFinder.new(
current_user, current_user,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- status = label_subscription_status(label, @project).inquiry if current_user - status = label_subscription_status(label, @project).inquiry if current_user
- subject = local_assigns[:subject] - subject = local_assigns[:subject]
- use_label_priority = local_assigns.fetch(:use_label_priority, false) - 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 - 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_merge_requests_link = show_label_issuables_link?(label, :merge_requests, project: @project)
- show_label_issues_link = show_label_issuables_link?(label, :issues, project: @project) - show_label_issues_link = show_label_issuables_link?(label, :issues, project: @project)
......
...@@ -23,8 +23,10 @@ feature 'Prioritize labels' do ...@@ -23,8 +23,10 @@ feature 'Prioritize labels' do
expect(page).to have_content('Star labels to start sorting by priority') expect(page).to have_content('Star labels to start sorting by priority')
page.within('.other-labels') do page.within('.other-labels') do
screenshot_and_open_image
all('.js-toggle-priority')[1].click all('.js-toggle-priority')[1].click
wait_for_requests wait_for_requests
screenshot_and_open_image
expect(page).not_to have_content('feature') expect(page).not_to have_content('feature')
end end
......
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