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
Boxiang Sun
gitlab-ce
Commits
3e4013f2
Commit
3e4013f2
authored
Aug 29, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove closing external issues by reference error
parent
2a8dec2c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
0 deletions
+9
-0
app/models/merge_request.rb
app/models/merge_request.rb
+2
-0
changelogs/unreleased/issue_36820.yml
changelogs/unreleased/issue_36820.yml
+5
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+2
-0
No files found.
app/models/merge_request.rb
View file @
3e4013f2
...
@@ -605,6 +605,8 @@ class MergeRequest < ActiveRecord::Base
...
@@ -605,6 +605,8 @@ class MergeRequest < ActiveRecord::Base
self
.
merge_requests_closing_issues
.
delete_all
self
.
merge_requests_closing_issues
.
delete_all
closes_issues
(
current_user
).
each
do
|
issue
|
closes_issues
(
current_user
).
each
do
|
issue
|
next
if
issue
.
is_a?
(
ExternalIssue
)
self
.
merge_requests_closing_issues
.
create!
(
issue:
issue
)
self
.
merge_requests_closing_issues
.
create!
(
issue:
issue
)
end
end
end
end
...
...
changelogs/unreleased/issue_36820.yml
0 → 100644
View file @
3e4013f2
---
title
:
Remove closing external issues by reference error
merge_request
:
author
:
type
:
fixed
spec/models/merge_request_spec.rb
View file @
3e4013f2
...
@@ -159,6 +159,7 @@ describe MergeRequest do
...
@@ -159,6 +159,7 @@ describe MergeRequest do
before
do
before
do
subject
.
project
.
has_external_issue_tracker
=
true
subject
.
project
.
has_external_issue_tracker
=
true
subject
.
project
.
save!
subject
.
project
.
save!
create
(
:jira_service
,
project:
subject
.
project
)
end
end
it
'does not cache issues from external trackers'
do
it
'does not cache issues from external trackers'
do
...
@@ -166,6 +167,7 @@ describe MergeRequest do
...
@@ -166,6 +167,7 @@ describe MergeRequest do
commit
=
double
(
'commit1'
,
safe_message:
"Fixes
#{
issue
.
to_reference
}
"
)
commit
=
double
(
'commit1'
,
safe_message:
"Fixes
#{
issue
.
to_reference
}
"
)
allow
(
subject
).
to
receive
(
:commits
).
and_return
([
commit
])
allow
(
subject
).
to
receive
(
:commits
).
and_return
([
commit
])
expect
{
subject
.
cache_merge_request_closes_issues!
(
subject
.
author
)
}.
not_to
raise_error
expect
{
subject
.
cache_merge_request_closes_issues!
(
subject
.
author
)
}.
not_to
change
(
subject
.
merge_requests_closing_issues
,
:count
)
expect
{
subject
.
cache_merge_request_closes_issues!
(
subject
.
author
)
}.
not_to
change
(
subject
.
merge_requests_closing_issues
,
:count
)
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