Commit ca29a313 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '217569-display-blocking-issue-count-in-haml-issue-list' into 'master'

Display blocking issue count on issues in haml issue list

See merge request gitlab-org/gitlab!44389
parents e3639102 7fa65934
......@@ -5,21 +5,23 @@
- issuable_mr = @issuable_meta_data[issuable.id].merge_requests_count
- if issuable_mr > 0
%li.issuable-mr.d-none.d-sm-block.has-tooltip{ title: _('Related merge requests') }
%li.issuable-mr.gl-display-none.gl-display-sm-block.has-tooltip{ title: _('Related merge requests') }
= image_tag('icon-merge-request-unmerged.svg', class: 'icon-merge-request-unmerged')
= issuable_mr
- if upvotes > 0
%li.issuable-upvotes.d-none.d-sm-block.has-tooltip{ title: _('Upvotes') }
= sprite_icon('thumb-up', css_class: "vertical-align-middle")
%li.issuable-upvotes.gl-display-none.gl-display-sm-block.has-tooltip{ title: _('Upvotes') }
= sprite_icon('thumb-up', css_class: "gl-vertical-align-middle")
= upvotes
- if downvotes > 0
%li.issuable-downvotes.d-none.d-sm-block.has-tooltip{ title: _('Downvotes') }
= sprite_icon('thumb-down', css_class: "vertical-align-middle")
%li.issuable-downvotes.gl-display-none.gl-display-sm-block.has-tooltip{ title: _('Downvotes') }
= sprite_icon('thumb-down', css_class: "gl-vertical-align-middle")
= downvotes
%li.issuable-comments.d-none.d-sm-block
= render_if_exists 'shared/issuable/blocking_issues_count', issuable: issuable
%li.issuable-comments.gl-display-none.gl-display-sm-block
= link_to issuable_path, class: ['has-tooltip', ('no-comments' if note_count == 0)], title: _('Comments') do
= sprite_icon('comments', css_class: 'gl-vertical-align-text-bottom')
= note_count
......@@ -10,7 +10,8 @@ module EE
sort_value_end_date => sort_title_end_date,
sort_value_less_weight => sort_title_less_weight,
sort_value_more_weight => sort_title_more_weight,
sort_value_weight => sort_title_weight
sort_value_weight => sort_title_weight,
sort_value_blocking_desc => sort_title_blocking
}.merge(super)
end
......@@ -95,6 +96,10 @@ module EE
s_('SortOptions|Weight')
end
def sort_title_blocking
s_('SortOptions|Blocking')
end
def sort_title_project_name
s_('SortOptions|Project')
end
......@@ -131,6 +136,10 @@ module EE
'weight'
end
def sort_value_blocking_desc
'blocking_issues_desc'
end
def sort_value_project_name_asc
'project_name_asc'
end
......
- allow_weight_sort = viewing_issues && (@project || @group)&.feature_available?(:issue_weights)
= sortable_item(sort_title_weight, page_filter_path(sort: sort_value_weight), sort_title) if allow_weight_sort
- allow_blocking_sort = viewing_issues && Feature.enabled?(:blocking_issues_counts)
= sortable_item(sort_title_blocking, page_filter_path(sort: sort_value_blocking_desc), sort_title) if allow_blocking_sort
- blocking_issues_counts_enabled = Feature.enabled?(:blocking_issues_counts)
- blocking_issues_count = @issuable_meta_data[issuable.id]&.blocking_issues_count || 0
- if blocking_issues_counts_enabled && blocking_issues_count > 0
%li.blocking-issues.gl-display-none.gl-display-sm-block.has-tooltip{ data: { testid: 'blocking-issues' }, title: _('Blocking issues') }
= sprite_icon('issue-block', css_class: "gl-vertical-align-middle")
= blocking_issues_count
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Blocking issues count' do
let_it_be(:project) { build(:project, :public) }
let_it_be(:blocked_issue) { build(:issue, project: project, created_at: 1.day.ago) }
let_it_be(:issue1) { build(:issue, project: project, created_at: 2.days.ago, title: 'blocks one issue') }
let_it_be(:issue2) { build(:issue, project: project, created_at: 3.days.ago, title: 'blocks two issues') }
before do
stub_feature_flags(vue_issuables_list: false)
visit project_issues_path(project)
end
before_all do
create(:issue_link, source: issue1, target: blocked_issue, link_type: IssueLink::TYPE_BLOCKS)
create(:issue_link, source: issue2, target: issue1, link_type: IssueLink::TYPE_BLOCKS)
create(:issue_link, source: issue2, target: blocked_issue, link_type: IssueLink::TYPE_BLOCKS)
end
it 'shows blocking issue counts on issue list row' do
page.within(".issues-list") do
page.within("li.issue:nth-child(2)") do
expect(page).to have_content('blocks one issue')
expect(page).to have_selector('[data-testid="blocking-issues"]')
expect(page.find('[data-testid="blocking-issues"]')).to have_content('1')
end
end
end
it 'sorts by blocking', :js do
find('.filter-dropdown-container .dropdown').click
page.within('ul.dropdown-menu.dropdown-menu-right li') do
expect(page).to have_content('Blocking')
click_link("Blocking")
end
page.within(".issues-list") do
page.within("li.issue:nth-child(1)") do
expect(page).to have_content('blocks two issues')
expect(page.find('[data-testid="blocking-issues"]')).to have_content('2')
end
page.within("li.issue:nth-child(2)") do
expect(page).to have_content('blocks one issue')
expect(page.find('[data-testid="blocking-issues"]')).to have_content('1')
end
end
end
end
......@@ -24536,6 +24536,9 @@ msgstr ""
msgid "SortOptions|Access level, descending"
msgstr ""
msgid "SortOptions|Blocking"
msgstr ""
msgid "SortOptions|Created date"
msgstr ""
......
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