BE review

This commit is contained in:
Luke Bennett 2018-05-25 12:38:45 +01:00
parent d400c94e60
commit c896ae7be8
No known key found for this signature in database
GPG Key ID: A738E9C68D3BF31A
3 changed files with 6 additions and 5 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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