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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
8f43298d
Commit
8f43298d
authored
Nov 30, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show local issues and MRs in "This X closes... / closed by..." sentence
parent
a8e05cec
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
4 deletions
+12
-4
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+5
-1
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+5
-1
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
app/views/projects/issues/_closed_by_box.html.haml
app/views/projects/issues/_closed_by_box.html.haml
+1
-1
No files found.
app/helpers/issues_helper.rb
View file @
8f43298d
...
@@ -84,7 +84,11 @@ module IssuesHelper
...
@@ -84,7 +84,11 @@ module IssuesHelper
end
end
def
merge_requests_sentence
(
merge_requests
)
def
merge_requests_sentence
(
merge_requests
)
merge_requests
.
map
(
&
:to_reference
).
to_sentence
(
last_word_connector:
', or '
)
# Sorting based on the `!123` or `group/project!123` reference will sort
# local merge requests first.
merge_requests
.
map
do
|
merge_request
|
merge_request
.
to_reference
(
@project
)
end
.
sort
.
to_sentence
(
last_word_connector:
', or '
)
end
end
def
url_to_emoji
(
name
)
def
url_to_emoji
(
name
)
...
...
app/helpers/merge_requests_helper.rb
View file @
8f43298d
...
@@ -39,7 +39,11 @@ module MergeRequestsHelper
...
@@ -39,7 +39,11 @@ module MergeRequestsHelper
end
end
def
issues_sentence
(
issues
)
def
issues_sentence
(
issues
)
issues
.
map
(
&
:to_reference
).
to_sentence
# Sorting based on the `#123` or `group/project#123` reference will sort
# local issues first.
issues
.
map
do
|
issue
|
issue
.
to_reference
(
@project
)
end
.
sort
.
to_sentence
end
end
def
mr_change_branches_path
(
merge_request
)
def
mr_change_branches_path
(
merge_request
)
...
...
app/models/merge_request.rb
View file @
8f43298d
...
@@ -316,7 +316,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -316,7 +316,7 @@ class MergeRequest < ActiveRecord::Base
issues
=
commits
.
flat_map
{
|
c
|
c
.
closes_issues
(
current_user
)
}
issues
=
commits
.
flat_map
{
|
c
|
c
.
closes_issues
(
current_user
)
}
issues
.
push
(
*
Gitlab
::
ClosingIssueExtractor
.
new
(
project
,
current_user
).
issues
.
push
(
*
Gitlab
::
ClosingIssueExtractor
.
new
(
project
,
current_user
).
closed_by_message
(
description
))
closed_by_message
(
description
))
issues
.
uniq
.
sort_by
(
&
:
id
)
issues
.
uniq
else
else
[]
[]
end
end
...
...
app/views/projects/issues/_closed_by_box.html.haml
View file @
8f43298d
.issue-closed-by-widget
.issue-closed-by-widget
=
icon
(
'check'
)
=
icon
(
'check'
)
This issue will be closed automatically when merge request
#{
gfm
(
merge_requests_sentence
(
@closed_by_merge_requests
.
sort
))
}
is accepted.
This issue will be closed automatically when merge request
#{
gfm
(
merge_requests_sentence
(
@closed_by_merge_requests
))
}
is accepted.
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