BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
CHANGELOG.md
CHANGELOG.md
+2
-0
issue.rb
app/models/issue.rb
+7
-1
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.
...
@@ -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)
## 8.14.0 (2016-11-22)
-
Use MergeRequestsClosingIssues cache data on Issue#closed_by_merge_requests method
## 8.13.0 (2016-10-22)
## 8.13.0 (2016-10-22)
-
Fix save button on project pipeline settings page. (!6955)
-
Fix save button on project pipeline settings page. (!6955)
...
...
app/models/issue.rb
View file @
49336710
...
@@ -211,7 +211,13 @@ class Issue < ActiveRecord::Base
...
@@ -211,7 +211,13 @@ class Issue < ActiveRecord::Base
note
.
all_references
(
current_user
,
extractor:
ext
)
note
.
all_references
(
current_user
,
extractor:
ext
)
end
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
end
def
moved?
def
moved?
...
...
spec/models/issue_spec.rb
View file @
49336710
...
@@ -100,11 +100,17 @@ describe Issue, models: true do
...
@@ -100,11 +100,17 @@ describe Issue, models: true do
end
end
it
'returns the merge request to close this issue'
do
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
])
expect
(
issue
.
closed_by_merge_requests
).
to
eq
([
mr
])
end
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
it
"returns an empty array when the current issue is closed already"
do
expect
(
closed_issue
.
closed_by_merge_requests
).
to
eq
([])
expect
(
closed_issue
.
closed_by_merge_requests
).
to
eq
([])
end
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