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
Léo-Paul Géneau
gitlab-ce
Commits
49336710
Commit
49336710
authored
Oct 19, 2016
by
Paco Guzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use MergeRequestsClosingIssues cache data on Issue#closed_by_merge_requests method
parent
c08435e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
CHANGELOG.md
CHANGELOG.md
+2
-0
app/models/issue.rb
app/models/issue.rb
+7
-1
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+7
-1
No files found.
CHANGELOG.md
View file @
49336710
...
...
@@ -2,6 +2,8 @@ Please view this file on the master branch, on stable branches it's out of date.
## 8.14.0 (2016-11-22)
-
Use MergeRequestsClosingIssues cache data on Issue#closed_by_merge_requests method
## 8.13.0 (2016-10-22)
-
Fix save button on project pipeline settings page. (!6955)
...
...
app/models/issue.rb
View file @
49336710
...
...
@@ -211,7 +211,13 @@ class Issue < ActiveRecord::Base
note
.
all_references
(
current_user
,
extractor:
ext
)
end
ext
.
merge_requests
.
select
{
|
mr
|
mr
.
open?
&&
mr
.
closes_issue?
(
self
)
}
merge_requests
=
ext
.
merge_requests
.
select
(
&
:
open
?)
if
merge_requests
.
any?
ids
=
MergeRequestsClosingIssues
.
where
(
merge_request_id:
merge_requests
.
map
(
&
:id
),
issue_id:
id
).
pluck
(:
merge_request_id
)
merge_requests
.
select
{
|
mr
|
mr
.
id
.
in?
(
ids
)
}
else
[]
end
end
def
moved?
...
...
spec/models/issue_spec.rb
View file @
49336710
...
...
@@ -100,11 +100,17 @@ describe Issue, models: true do
end
it
'returns the merge request to close this issue'
do
allow
(
mr
).
to
receive
(
:closes_issue?
).
with
(
issue
).
and_return
(
true
)
mr
expect
(
issue
.
closed_by_merge_requests
).
to
eq
([
mr
])
end
it
"returns an empty array when the merge request is closed already"
do
closed_mr
expect
(
issue
.
closed_by_merge_requests
).
to
eq
([])
end
it
"returns an empty array when the current issue is closed already"
do
expect
(
closed_issue
.
closed_by_merge_requests
).
to
eq
([])
end
...
...
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