Skip to content
Snippets Groups Projects

Hide issues and MRs in labels list if disabled

Open username-removed-143453 requested to merge sophie-h/gitlab-ce:patch-15 into master
2 unresolved threads
@@ -11,12 +11,14 @@
= icon('caret-down')
.dropdown-menu.dropdown-menu-align-right
%ul
%li
= link_to_label(label, subject: subject, type: :merge_request) do
view merge requests
%li
= link_to_label(label, subject: subject) do
view open issues
- if !(defined?(@project) && label.is_a?(ProjectLabel) && !@project.merge_requests_enabled?)
    • What is this condition trying to achieve? My understanding is:

      • for GroupLabel always show the link
      • for ProjectLabel show the link only when merge requests are enabled

      Is that correct? Is it possible that label is a project label but @project is not defined?

      If not, then this can be rewritten as:

      if label.is_a?(GroupLabel) || @project.merge_request_enabled?
Please register or sign in to reply
%li
= link_to_label(label, subject: subject, type: :merge_request) do
view merge requests
- if !(defined?(@project) && label.is_a?(ProjectLabel) && !@project.issues_enabled?)
%li
= link_to_label(label, subject: subject) do
view open issues
- if current_user && defined?(@project)
%li.label-subscription
- if label.is_a?(ProjectLabel)
@@ -37,10 +39,12 @@
= link_to 'Delete', destroy_label_path(label), title: 'Delete', method: :delete, data: {confirm: 'Remove this label? Are you sure?'}
.pull-right.hidden-xs.hidden-sm.hidden-md
= link_to_label(label, subject: subject, type: :merge_request, css_class: 'btn btn-transparent btn-action') do
view merge requests
= link_to_label(label, subject: subject, css_class: 'btn btn-transparent btn-action') do
view open issues
- if !(defined?(@project) && label.is_a?(ProjectLabel) && !@project.merge_requests_enabled?)
= link_to_label(label, subject: subject, type: :merge_request, css_class: 'btn btn-transparent btn-action') do
view merge requests
- if !(defined?(@project) && label.is_a?(ProjectLabel) && !@project.issues_enabled?)
= link_to_label(label, subject: subject, css_class: 'btn btn-transparent btn-action') do
view open issues
- if current_user && defined?(@project)
.label-subscription.inline
@@ -82,4 +86,4 @@
new gl.ProjectLabelSubscription('##{dom_id(label)} .label-subscription');
- else
:javascript
new gl.GroupLabelSubscription('##{dom_id(label)} .label-subscription');
new gl.GroupLabelSubscription('##{dom_id(label)} .label-subscription');
Please register or sign in to reply
\ No newline at end of file
Loading