Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c179f4dd
Commit
c179f4dd
authored
Aug 16, 2021
by
Amy Qualls
Committed by
Jose Ivan Vargas
Aug 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the word 'issues' to the mentions string
parent
861f342b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
29 deletions
+65
-29
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_related_links.vue
...rge_request_widget/components/mr_widget_related_links.vue
+5
-3
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
...cripts/vue_merge_request_widget/stores/mr_widget_store.js
+7
-1
app/presenters/merge_request_presenter.rb
app/presenters/merge_request_presenter.rb
+12
-5
app/serializers/merge_request_widget_entity.rb
app/serializers/merge_request_widget_entity.rb
+8
-0
ee/spec/features/merge_request/user_sees_closing_issues_message_spec.rb
...es/merge_request/user_sees_closing_issues_message_spec.rb
+1
-1
locale/gitlab.pot
locale/gitlab.pot
+8
-4
spec/features/merge_request/user_sees_closing_issues_message_spec.rb
...es/merge_request/user_sees_closing_issues_message_spec.rb
+8
-8
spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js
.../vue_mr_widget/components/mr_widget_related_links_spec.js
+15
-6
spec/serializers/merge_request_widget_entity_spec.rb
spec/serializers/merge_request_widget_entity_spec.rb
+1
-1
No files found.
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_related_links.vue
View file @
c179f4dd
<
script
>
<
script
>
/* eslint-disable vue/no-v-html */
/* eslint-disable vue/no-v-html */
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
,
n__
}
from
'
~/locale
'
;
export
default
{
export
default
{
name
:
'
MRWidgetRelatedLinks
'
,
name
:
'
MRWidgetRelatedLinks
'
,
...
@@ -24,7 +24,8 @@ export default {
...
@@ -24,7 +24,8 @@ export default {
if
(
this
.
state
===
'
closed
'
)
{
if
(
this
.
state
===
'
closed
'
)
{
return
s__
(
'
mrWidget|Did not close
'
);
return
s__
(
'
mrWidget|Did not close
'
);
}
}
return
s__
(
'
mrWidget|Closes
'
);
return
n__
(
'
mrWidget|Closes issue
'
,
'
mrWidget|Closes issues
'
,
this
.
relatedLinks
.
closingCount
);
},
},
},
},
};
};
...
@@ -33,7 +34,8 @@ export default {
...
@@ -33,7 +34,8 @@ export default {
<section
class=
"mr-info-list gl-ml-7 gl-pb-5"
>
<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.closing"
>
{{
closesText
}}
<span
v-html=
"relatedLinks.closing"
></span></p>
<p
v-if=
"relatedLinks.mentioned"
>
<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>
<p
v-if=
"relatedLinks.assignToMe"
><span
v-html=
"relatedLinks.assignToMe"
></span></p>
<p
v-if=
"relatedLinks.assignToMe"
><span
v-html=
"relatedLinks.assignToMe"
></span></p>
</section>
</section>
...
...
app/assets/javascripts/vue_merge_request_widget/stores/mr_widget_store.js
View file @
c179f4dd
...
@@ -71,7 +71,13 @@ export default class MergeRequestStore {
...
@@ -71,7 +71,13 @@ export default class MergeRequestStore {
const
assignToMe
=
links
.
assign_to_closing
;
const
assignToMe
=
links
.
assign_to_closing
;
if
(
closing
||
mentioned
||
assignToMe
)
{
if
(
closing
||
mentioned
||
assignToMe
)
{
this
.
relatedLinks
=
{
closing
,
mentioned
,
assignToMe
};
this
.
relatedLinks
=
{
closing
,
mentioned
,
assignToMe
,
closingCount
:
links
.
closing_count
,
mentionedCount
:
links
.
mentioned_count
,
};
}
}
}
}
...
...
app/presenters/merge_request_presenter.rb
View file @
c179f4dd
...
@@ -139,7 +139,6 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
...
@@ -139,7 +139,6 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
end
end
def
mentioned_issues_links
def
mentioned_issues_links
mentioned_issues
=
issues_mentioned_but_not_closing
(
current_user
)
markdown
(
markdown
(
issues_sentence
(
project
,
mentioned_issues
),
issues_sentence
(
project
,
mentioned_issues
),
pipeline: :gfm
,
pipeline: :gfm
,
...
@@ -239,6 +238,18 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
...
@@ -239,6 +238,18 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
APPROVALS_WIDGET_BASE_TYPE
APPROVALS_WIDGET_BASE_TYPE
end
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
private
def
cached_can_be_reverted?
def
cached_can_be_reverted?
...
@@ -253,10 +264,6 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
...
@@ -253,10 +264,6 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
# rubocop: enable CodeReuse/ServiceClass
# rubocop: enable CodeReuse/ServiceClass
end
end
def
closing_issues
@closing_issues
||=
visible_closing_issues_for
(
current_user
)
end
def
pipeline
def
pipeline
@pipeline
||=
actual_head_pipeline
@pipeline
||=
actual_head_pipeline
end
end
...
...
app/serializers/merge_request_widget_entity.rb
View file @
c179f4dd
...
@@ -110,9 +110,17 @@ class MergeRequestWidgetEntity < Grape::Entity
...
@@ -110,9 +110,17 @@ class MergeRequestWidgetEntity < Grape::Entity
presenter
(
merge_request
).
closing_issues_links
presenter
(
merge_request
).
closing_issues_links
end
end
expose
:closing_count
do
|
merge_request
|
presenter
(
merge_request
).
closing_issues
.
size
end
expose
:mentioned_but_not_closing
do
|
merge_request
|
expose
:mentioned_but_not_closing
do
|
merge_request
|
presenter
(
merge_request
).
mentioned_issues_links
presenter
(
merge_request
).
mentioned_issues_links
end
end
expose
:mentioned_count
do
|
merge_request
|
presenter
(
merge_request
).
mentioned_issues
.
size
end
end
end
expose
:codeclimate
,
if:
->
(
mr
,
_
)
{
head_pipeline_downloadable_path_for_report_type
(
:codequality
)
}
do
expose
:codeclimate
,
if:
->
(
mr
,
_
)
{
head_pipeline_downloadable_path_for_report_type
(
:codequality
)
}
do
...
...
ee/spec/features/merge_request/user_sees_closing_issues_message_spec.rb
View file @
c179f4dd
...
@@ -29,7 +29,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
...
@@ -29,7 +29,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
let
(
:merge_request_description
)
{
"Description
\n\n
closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_description
)
{
"Description
\n\n
closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
it
'displays closing issue message exactly one time'
do
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
end
end
end
locale/gitlab.pot
View file @
c179f4dd
...
@@ -39538,8 +39538,10 @@ msgstr ""
...
@@ -39538,8 +39538,10 @@ msgstr ""
msgid "mrWidget|Closed by"
msgid "mrWidget|Closed by"
msgstr ""
msgstr ""
msgid "mrWidget|Closes"
msgid "mrWidget|Closes issue"
msgstr ""
msgid_plural "mrWidget|Closes issues"
msgstr[0] ""
msgstr[1] ""
msgid "mrWidget|Delete source branch"
msgid "mrWidget|Delete source branch"
msgstr ""
msgstr ""
...
@@ -39574,8 +39576,10 @@ msgstr ""
...
@@ -39574,8 +39576,10 @@ msgstr ""
msgid "mrWidget|Members who can merge are allowed to add commits."
msgid "mrWidget|Members who can merge are allowed to add commits."
msgstr ""
msgstr ""
msgid "mrWidget|Mentions"
msgid "mrWidget|Mentions issue"
msgstr ""
msgid_plural "mrWidget|Mentions issues"
msgstr[0] ""
msgstr[1] ""
msgid "mrWidget|Merge"
msgid "mrWidget|Merge"
msgstr ""
msgstr ""
...
...
spec/features/merge_request/user_sees_closing_issues_message_spec.rb
View file @
c179f4dd
...
@@ -31,7 +31,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
...
@@ -31,7 +31,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
let
(
:merge_request_description
)
{
"Description
\n\n
closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_description
)
{
"Description
\n\n
closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
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
end
end
...
@@ -39,7 +39,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
...
@@ -39,7 +39,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
let
(
:merge_request_description
)
{
"Description
\n\n
Refers to
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_description
)
{
"Description
\n\n
Refers to
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
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
end
end
...
@@ -47,8 +47,8 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
...
@@ -47,8 +47,8 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
let
(
:merge_request_title
)
{
"closes
#{
issue_1
.
to_reference
}
\n\n
refers to
#{
issue_2
.
to_reference
}
"
}
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
it
'does not display closing issue message'
do
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"Closes
issue
#{
issue_1
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"Mentions
#{
issue_2
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"Mentions
issue
#{
issue_2
.
to_reference
}
"
)
end
end
end
end
...
@@ -56,7 +56,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
...
@@ -56,7 +56,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
let
(
:merge_request_title
)
{
"closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_title
)
{
"closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
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
end
end
...
@@ -64,7 +64,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
...
@@ -64,7 +64,7 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
let
(
:merge_request_title
)
{
"Refers to
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_title
)
{
"Refers to
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
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
end
end
...
@@ -72,8 +72,8 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
...
@@ -72,8 +72,8 @@ RSpec.describe 'Merge request > User sees closing issues message', :js do
let
(
:merge_request_title
)
{
"closes
#{
issue_1
.
to_reference
}
\n\n
refers to
#{
issue_2
.
to_reference
}
"
}
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
it
'does not display closing issue message'
do
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"Closes
issue
#{
issue_1
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"Mentions
#{
issue_2
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"Mentions
issue
#{
issue_2
.
to_reference
}
"
)
end
end
end
end
end
end
spec/frontend/vue_mr_widget/components/mr_widget_related_links_spec.js
View file @
c179f4dd
...
@@ -17,7 +17,7 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -17,7 +17,7 @@ describe('MRWidgetRelatedLinks', () => {
it
(
'
returns Closes text for open merge request
'
,
()
=>
{
it
(
'
returns Closes text for open merge request
'
,
()
=>
{
createComponent
({
state
:
'
open
'
,
relatedLinks
:
{}
});
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
'
,
()
=>
{
it
(
'
returns correct text for closed merge request
'
,
()
=>
{
...
@@ -38,6 +38,7 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -38,6 +38,7 @@ describe('MRWidgetRelatedLinks', () => {
createComponent
({
createComponent
({
relatedLinks
:
{
relatedLinks
:
{
closing
:
'
<a href="#">#23</a> and <a>#42</a>
'
,
closing
:
'
<a href="#">#23</a> and <a>#42</a>
'
,
closingCount
:
2
,
},
},
});
});
const
content
=
wrapper
const
content
=
wrapper
...
@@ -45,7 +46,7 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -45,7 +46,7 @@ describe('MRWidgetRelatedLinks', () => {
.
replace
(
/
\n(\s)
+/g
,
'
'
)
.
replace
(
/
\n(\s)
+/g
,
'
'
)
.
trim
();
.
trim
();
expect
(
content
).
toContain
(
'
Closes #23 and #42
'
);
expect
(
content
).
toContain
(
'
Closes
issues
#23 and #42
'
);
expect
(
content
).
not
.
toContain
(
'
Mentions
'
);
expect
(
content
).
not
.
toContain
(
'
Mentions
'
);
});
});
...
@@ -53,11 +54,17 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -53,11 +54,17 @@ describe('MRWidgetRelatedLinks', () => {
createComponent
({
createComponent
({
relatedLinks
:
{
relatedLinks
:
{
mentioned
:
'
<a href="#">#7</a>
'
,
mentioned
:
'
<a href="#">#7</a>
'
,
mentionedCount
:
1
,
},
},
});
});
expect
(
wrapper
.
text
().
trim
()).
toContain
(
'
Mentions #7
'
);
const
content
=
wrapper
expect
(
wrapper
.
text
().
trim
()).
not
.
toContain
(
'
Closes
'
);
.
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
'
,
()
=>
{
it
(
'
should have closing and mentioned issues at the same time
'
,
()
=>
{
...
@@ -65,6 +72,8 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -65,6 +72,8 @@ describe('MRWidgetRelatedLinks', () => {
relatedLinks
:
{
relatedLinks
:
{
closing
:
'
<a href="#">#7</a>
'
,
closing
:
'
<a href="#">#7</a>
'
,
mentioned
:
'
<a href="#">#23</a> and <a>#42</a>
'
,
mentioned
:
'
<a href="#">#23</a> and <a>#42</a>
'
,
closingCount
:
1
,
mentionedCount
:
2
,
},
},
});
});
const
content
=
wrapper
const
content
=
wrapper
...
@@ -72,8 +81,8 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -72,8 +81,8 @@ describe('MRWidgetRelatedLinks', () => {
.
replace
(
/
\n(\s)
+/g
,
'
'
)
.
replace
(
/
\n(\s)
+/g
,
'
'
)
.
trim
();
.
trim
();
expect
(
content
).
toContain
(
'
Closes #7
'
);
expect
(
content
).
toContain
(
'
Closes
issue
#7
'
);
expect
(
content
).
toContain
(
'
Mentions #23 and #42
'
);
expect
(
content
).
toContain
(
'
Mentions
issues
#23 and #42
'
);
});
});
it
(
'
should have assing issues link
'
,
()
=>
{
it
(
'
should have assing issues link
'
,
()
=>
{
...
...
spec/serializers/merge_request_widget_entity_spec.rb
View file @
c179f4dd
...
@@ -58,7 +58,7 @@ RSpec.describe MergeRequestWidgetEntity do
...
@@ -58,7 +58,7 @@ RSpec.describe MergeRequestWidgetEntity do
data
=
described_class
.
new
(
resource
,
request:
request
,
issues_links:
true
).
as_json
data
=
described_class
.
new
(
resource
,
request:
request
,
issues_links:
true
).
as_json
expect
(
data
).
to
include
(
:issues_links
)
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
end
it
'omits issue links by default'
do
it
'omits issue links by default'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment