Skip to content
Snippets Groups Projects
Commit c179f4dd authored by Amy Qualls's avatar Amy Qualls Committed by Jose Ivan Vargas Lopez
Browse files

Add the word 'issues' to the mentions string

parent 861f342b
No related branches found
No related tags found
No related merge requests found
<script>
/* eslint-disable vue/no-v-html */
import { s__ } from '~/locale';
import { s__, n__ } from '~/locale';
 
export default {
name: 'MRWidgetRelatedLinks',
Loading
Loading
@@ -24,7 +24,8 @@ export default {
if (this.state === 'closed') {
return s__('mrWidget|Did not close');
}
return s__('mrWidget|Closes');
return n__('mrWidget|Closes issue', 'mrWidget|Closes issues', this.relatedLinks.closingCount);
},
},
};
Loading
Loading
@@ -33,7 +34,8 @@ export default {
<section class="mr-info-list gl-ml-7 gl-pb-5">
<p v-if="relatedLinks.closing">{{ closesText }} <span v-html="relatedLinks.closing"></span></p>
<p v-if="relatedLinks.mentioned">
{{ s__('mrWidget|Mentions') }} <span v-html="relatedLinks.mentioned"></span>
{{ n__('mrWidget|Mentions issue', 'mrWidget|Mentions issues', relatedLinks.mentionedCount) }}
<span v-html="relatedLinks.mentioned"></span>
</p>
<p v-if="relatedLinks.assignToMe"><span v-html="relatedLinks.assignToMe"></span></p>
</section>
Loading
Loading
Loading
Loading
@@ -71,7 +71,13 @@ export default class MergeRequestStore {
const assignToMe = links.assign_to_closing;
 
if (closing || mentioned || assignToMe) {
this.relatedLinks = { closing, mentioned, assignToMe };
this.relatedLinks = {
closing,
mentioned,
assignToMe,
closingCount: links.closing_count,
mentionedCount: links.mentioned_count,
};
}
}
 
Loading
Loading
Loading
Loading
@@ -139,7 +139,6 @@ def closing_issues_links
end
 
def mentioned_issues_links
mentioned_issues = issues_mentioned_but_not_closing(current_user)
markdown(
issues_sentence(project, mentioned_issues),
pipeline: :gfm,
Loading
Loading
@@ -239,6 +238,18 @@ def approvals_widget_type
APPROVALS_WIDGET_BASE_TYPE
end
 
def closing_issues
strong_memoize(:closing_issues) do
visible_closing_issues_for(current_user)
end
end
def mentioned_issues
strong_memoize(:mentioned_issues) do
issues_mentioned_but_not_closing(current_user)
end
end
private
 
def cached_can_be_reverted?
Loading
Loading
@@ -253,10 +264,6 @@ def conflicts
# rubocop: enable CodeReuse/ServiceClass
end
 
def closing_issues
@closing_issues ||= visible_closing_issues_for(current_user)
end
def pipeline
@pipeline ||= actual_head_pipeline
end
Loading
Loading
Loading
Loading
@@ -110,9 +110,17 @@ class MergeRequestWidgetEntity < Grape::Entity
presenter(merge_request).closing_issues_links
end
 
expose :closing_count do |merge_request|
presenter(merge_request).closing_issues.size
end
expose :mentioned_but_not_closing do |merge_request|
presenter(merge_request).mentioned_issues_links
end
expose :mentioned_count do |merge_request|
presenter(merge_request).mentioned_issues.size
end
end
 
expose :codeclimate, if: -> (mr, _) { head_pipeline_downloadable_path_for_report_type(:codequality) } do
Loading
Loading
Loading
Loading
@@ -29,7 +29,7 @@
let(:merge_request_description) { "Description\n\nclosing #{issue_1.to_reference}, #{issue_2.to_reference}" }
 
it 'displays closing issue message exactly one time' do
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}", count: 1)
expect(page).to have_content("Closes issues #{issue_1.to_reference} and #{issue_2.to_reference}", count: 1)
end
end
end
Loading
Loading
@@ -39538,8 +39538,10 @@ msgstr ""
msgid "mrWidget|Closed by"
msgstr ""
 
msgid "mrWidget|Closes"
msgstr ""
msgid "mrWidget|Closes issue"
msgid_plural "mrWidget|Closes issues"
msgstr[0] ""
msgstr[1] ""
 
msgid "mrWidget|Delete source branch"
msgstr ""
Loading
Loading
@@ -39574,8 +39576,10 @@ msgstr ""
msgid "mrWidget|Members who can merge are allowed to add commits."
msgstr ""
 
msgid "mrWidget|Mentions"
msgstr ""
msgid "mrWidget|Mentions issue"
msgid_plural "mrWidget|Mentions issues"
msgstr[0] ""
msgstr[1] ""
 
msgid "mrWidget|Merge"
msgstr ""
Loading
Loading
Loading
Loading
@@ -31,7 +31,7 @@
let(:merge_request_description) { "Description\n\nclosing #{issue_1.to_reference}, #{issue_2.to_reference}" }
 
it 'does not display closing issue message' do
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}")
expect(page).to have_content("Closes issues #{issue_1.to_reference} and #{issue_2.to_reference}")
end
end
 
Loading
Loading
@@ -39,7 +39,7 @@
let(:merge_request_description) { "Description\n\nRefers to #{issue_1.to_reference} and #{issue_2.to_reference}" }
 
it 'does not display closing issue message' do
expect(page).to have_content("Mentions #{issue_1.to_reference} and #{issue_2.to_reference}")
expect(page).to have_content("Mentions issues #{issue_1.to_reference} and #{issue_2.to_reference}")
end
end
 
Loading
Loading
@@ -47,8 +47,8 @@
let(:merge_request_title) { "closes #{issue_1.to_reference}\n\n refers to #{issue_2.to_reference}" }
 
it 'does not display closing issue message' do
expect(page).to have_content("Closes #{issue_1.to_reference}")
expect(page).to have_content("Mentions #{issue_2.to_reference}")
expect(page).to have_content("Closes issue #{issue_1.to_reference}")
expect(page).to have_content("Mentions issue #{issue_2.to_reference}")
end
end
 
Loading
Loading
@@ -56,7 +56,7 @@
let(:merge_request_title) { "closing #{issue_1.to_reference}, #{issue_2.to_reference}" }
 
it 'does not display closing issue message' do
expect(page).to have_content("Closes #{issue_1.to_reference} and #{issue_2.to_reference}")
expect(page).to have_content("Closes issues #{issue_1.to_reference} and #{issue_2.to_reference}")
end
end
 
Loading
Loading
@@ -64,7 +64,7 @@
let(:merge_request_title) { "Refers to #{issue_1.to_reference} and #{issue_2.to_reference}" }
 
it 'does not display closing issue message' do
expect(page).to have_content("Mentions #{issue_1.to_reference} and #{issue_2.to_reference}")
expect(page).to have_content("Mentions issues #{issue_1.to_reference} and #{issue_2.to_reference}")
end
end
 
Loading
Loading
@@ -72,8 +72,8 @@
let(:merge_request_title) { "closes #{issue_1.to_reference}\n\n refers to #{issue_2.to_reference}" }
 
it 'does not display closing issue message' do
expect(page).to have_content("Closes #{issue_1.to_reference}")
expect(page).to have_content("Mentions #{issue_2.to_reference}")
expect(page).to have_content("Closes issue #{issue_1.to_reference}")
expect(page).to have_content("Mentions issue #{issue_2.to_reference}")
end
end
end
Loading
Loading
@@ -17,7 +17,7 @@ describe('MRWidgetRelatedLinks', () => {
it('returns Closes text for open merge request', () => {
createComponent({ state: 'open', relatedLinks: {} });
 
expect(wrapper.vm.closesText).toBe('Closes');
expect(wrapper.vm.closesText).toBe('Closes issues');
});
 
it('returns correct text for closed merge request', () => {
Loading
Loading
@@ -38,6 +38,7 @@ describe('MRWidgetRelatedLinks', () => {
createComponent({
relatedLinks: {
closing: '<a href="#">#23</a> and <a>#42</a>',
closingCount: 2,
},
});
const content = wrapper
Loading
Loading
@@ -45,7 +46,7 @@ describe('MRWidgetRelatedLinks', () => {
.replace(/\n(\s)+/g, ' ')
.trim();
 
expect(content).toContain('Closes #23 and #42');
expect(content).toContain('Closes issues #23 and #42');
expect(content).not.toContain('Mentions');
});
 
Loading
Loading
@@ -53,11 +54,17 @@ describe('MRWidgetRelatedLinks', () => {
createComponent({
relatedLinks: {
mentioned: '<a href="#">#7</a>',
mentionedCount: 1,
},
});
 
expect(wrapper.text().trim()).toContain('Mentions #7');
expect(wrapper.text().trim()).not.toContain('Closes');
const content = wrapper
.text()
.replace(/\n(\s)+/g, ' ')
.trim();
expect(content).toContain('Mentions issue #7');
expect(content).not.toContain('Closes issues');
});
 
it('should have closing and mentioned issues at the same time', () => {
Loading
Loading
@@ -65,6 +72,8 @@ describe('MRWidgetRelatedLinks', () => {
relatedLinks: {
closing: '<a href="#">#7</a>',
mentioned: '<a href="#">#23</a> and <a>#42</a>',
closingCount: 1,
mentionedCount: 2,
},
});
const content = wrapper
Loading
Loading
@@ -72,8 +81,8 @@ describe('MRWidgetRelatedLinks', () => {
.replace(/\n(\s)+/g, ' ')
.trim();
 
expect(content).toContain('Closes #7');
expect(content).toContain('Mentions #23 and #42');
expect(content).toContain('Closes issue #7');
expect(content).toContain('Mentions issues #23 and #42');
});
 
it('should have assing issues link', () => {
Loading
Loading
Loading
Loading
@@ -58,7 +58,7 @@
data = described_class.new(resource, request: request, issues_links: true).as_json
 
expect(data).to include(:issues_links)
expect(data[:issues_links]).to include(:assign_to_closing, :closing, :mentioned_but_not_closing)
expect(data[:issues_links]).to include(:assign_to_closing, :closing, :mentioned_but_not_closing, :closing_count, :mentioned_count)
end
 
it 'omits issue links by default' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment