Fix accuracy of 'prioritized label' badge, when given different contexts

This commit is contained in:
Luke Bennett 2018-05-24 13:29:00 +01:00
parent aba153a46d
commit d400c94e60
No known key found for this signature in database
GPG Key ID: A738E9C68D3BF31A
4 changed files with 7 additions and 4 deletions

View File

@ -24,7 +24,7 @@
- if can_admin_label
%h5{ class: ('hide' if hide) } Labels
%ul.content-list.manage-labels-list.js-other-labels
= render partial: 'shared/label', subject: @group, collection: @labels, as: :label
= render partial: 'shared/label', subject: @group, collection: @labels, as: :label, locals: { use_label_priority: true }
= paginate @labels, theme: 'gitlab'
- else
= render 'shared/empty_states/labels'

View File

@ -28,7 +28,7 @@
#js-priority-labels-empty-state.priority-labels-empty-state{ class: "#{'hidden' unless @prioritized_labels.empty?}" }
= render 'shared/empty_states/priority_labels'
- if @prioritized_labels.present?
= render partial: 'shared/label', subject: @project, collection: @prioritized_labels, as: :label
= render partial: 'shared/label', subject: @project, collection: @prioritized_labels, as: :label, locals: { force_priority: true }
- if @labels.present?
.other-labels

View File

@ -1,13 +1,15 @@
- label_css_id = dom_id(label)
- 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)
- 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)
- tooltip_title = "#{status.unsubscribed? ? 'Subscribe' : 'Unsubscribe'} at #{label.is_a?(ProjectLabel) ? 'project' : 'group'} level"
%li.label-list-item{ id: label_css_id, data: { id: label.id } }
= render "shared/label_row", label: label, subject: subject
= render "shared/label_row", label: label, subject: subject, force_priority: force_priority
%ul.label-actions-list
- if controller.is_a?(Projects::LabelsController)
%li.inline

View File

@ -1,4 +1,5 @@
- subject = local_assigns[:subject]
- force_priority = local_assigns.fetch(:force_priority, false)
- show_label_issues_link = show_label_issuables_link?(label, :issues, project: @project)
- show_label_merge_requests_link = show_label_issuables_link?(label, :merge_requests, project: @project)
@ -17,6 +18,6 @@
·
%li.label-link-item.inline
= link_to_label(label, subject: subject, type: :merge_request) { _('Merge requests') }
- if label.priority?
- if force_priority
%li.label-link-item.js-priority-badge.inline.prepend-left-10
.label-badge.label-badge-blue= _('Prioritized label')