Make "moved" Link to Moved Issue

The text "moved" now links to the issue the closed issue was moved to.
This commit is contained in:
Andrew Fontaine 2019-02-15 14:05:23 -05:00
parent c8bf9f78f3
commit 37b9173bd5
5 changed files with 34 additions and 9 deletions

View File

@ -32,6 +32,11 @@
&.status-box-issue-closed,
&.status-box-mr-merged {
background-color: $blue-500;
a {
color: inherit;
text-decoration: underline;
}
}
&.status-box-open {

View File

@ -14,9 +14,12 @@
.detail-page-header-body
.issuable-status-box.status-box.status-box-issue-closed{ class: issue_button_visibility(@issue, false) }
= sprite_icon('mobile-issue-close', size: 16, css_class: 'd-block d-sm-none')
%span.d-none.d-sm-block
.d-none.d-sm-block
- if @issue.moved?
= _("Closed (moved)")
- moved_link_start = "<a href=\"#{issue_path(@issue.moved_to)}\">".html_safe
- moved_link_end = '</a>'.html_safe
= s_('IssuableStatus|Closed (%{moved_link_start}moved%{moved_link_end})').html_safe % {moved_link_start: moved_link_start,
moved_link_end: moved_link_end}
- else
= _("Closed")
.issuable-status-box.status-box.status-box-open{ class: issue_button_visibility(@issue, true) }

View File

@ -0,0 +1,5 @@
---
title: Add Link from Closed (moved) Issues to Moved Issue
merge_request: 25300
author:
type: added

View File

@ -1542,9 +1542,6 @@ msgstr ""
msgid "Closed"
msgstr ""
msgid "Closed (moved)"
msgstr ""
msgid "ClusterIntegration| %{custom_domain_start}More information%{custom_domain_end}."
msgstr ""
@ -4097,6 +4094,9 @@ msgstr ""
msgid "Invoke Time"
msgstr ""
msgid "IssuableStatus|Closed (%{moved_link_start}moved%{moved_link_end})"
msgstr ""
msgid "Issue"
msgstr ""

View File

@ -21,12 +21,24 @@ describe 'projects/issues/show' do
allow(issue).to receive(:closed?).and_return(true)
end
it 'shows "Closed (moved)" if an issue has been moved' do
allow(issue).to receive(:moved?).and_return(true)
context 'when the issue was moved' do
let(:new_issue) { create(:issue, project: project, author: user) }
render
before do
issue.moved_to = new_issue
end
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (moved)')
it 'shows "Closed (moved)" if an issue has been moved' do
render
expect(rendered).to have_selector('.status-box-issue-closed:not(.hidden)', text: 'Closed (moved)')
end
it 'links "moved" to the new issue the original issue was moved to' do
render
expect(rendered).to have_selector("a[href=\"#{issue_path(new_issue)}\"]", text: 'moved')
end
end
it 'shows "Closed" if an issue has not been moved' do