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
adc70d57
Commit
adc70d57
authored
Aug 15, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create system notes only if issue was successfully related
parent
105b4371
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
app/services/issue_links/create_service.rb
app/services/issue_links/create_service.rb
+2
-1
changelogs/unreleased-ee/36443-do-not-create-notes-if-issue-was-not-successfully-related.yml
...ot-create-notes-if-issue-was-not-successfully-related.yml
+5
-0
spec/services/issue_links/create_service_spec.rb
spec/services/issue_links/create_service_spec.rb
+16
-0
No files found.
app/services/issue_links/create_service.rb
View file @
adc70d57
...
...
@@ -21,8 +21,9 @@ module IssueLinks
end
end
# Returns a Boolean indicating if the Issue was related.
def
relate_issues
(
referenced_issue
)
IssueLink
.
create
(
source:
@issue
,
target:
referenced_issue
)
IssueLink
.
new
(
source:
@issue
,
target:
referenced_issue
).
save
end
def
create_notes
(
referenced_issue
)
...
...
changelogs/unreleased-ee/36443-do-not-create-notes-if-issue-was-not-successfully-related.yml
0 → 100644
View file @
adc70d57
---
title
:
Create system notes only if issue was successfully related
merge_request
:
author
:
type
:
fixed
spec/services/issue_links/create_service_spec.rb
View file @
adc70d57
...
...
@@ -60,6 +60,22 @@ describe IssueLinks::CreateService do
end
end
context
'source and target are the same issue'
do
let
(
:params
)
do
{
issue_references:
[
issue
.
to_reference
]
}
end
it
'does not create notes'
do
expect
(
SystemNoteService
).
not_to
receive
(
:relate_issue
)
subject
end
it
'no relationship is created'
do
expect
{
subject
}.
not_to
change
(
IssueLink
,
:count
)
end
end
context
'when there is an issue to relate'
do
let
(
:issue_a
)
{
create
:issue
,
project:
project
}
let
(
:another_project
)
{
create
:project
,
namespace:
project
.
namespace
}
...
...
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