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
ad67548f
Commit
ad67548f
authored
Apr 25, 2017
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CreateRelatedIssueService
parent
1e22d67b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
45 deletions
+0
-45
app/services/create_related_issue_service.rb
app/services/create_related_issue_service.rb
+0
-45
No files found.
app/services/create_related_issue_service.rb
deleted
100644 → 0
View file @
1e22d67b
class
CreateRelatedIssueService
<
BaseService
def
initialize
(
issue
,
user
,
params
)
@issue
,
@current_user
,
@params
=
issue
,
user
,
params
.
dup
end
def
execute
if
referenced_issues
.
blank?
return
error
(
'No Issue found for given reference'
,
401
)
end
begin
create_related_issues!
rescue
=>
exception
return
error
(
exception
.
message
,
401
)
end
success
(
message:
"
#{
issues_sentence
(
referenced_issues
)
}
were successfully related"
)
end
private
def
create_related_issues!
RelatedIssue
.
transaction
do
referenced_issues
.
each
do
|
referenced_issue
|
RelatedIssue
.
create!
(
issue:
@issue
,
related_issue:
referenced_issue
)
end
end
end
def
referenced_issues
@referenced_issues
||=
begin
issue_references
=
params
[
:issue_references
]
text
=
issue_references
.
join
(
' '
)
extractor
=
Gitlab
::
ReferenceExtractor
.
new
(
@issue
.
project
,
@current_user
)
extractor
.
analyze
(
text
)
extractor
.
issues
end
end
def
issues_sentence
(
issues
)
issues
.
map
{
|
issue
|
issue
.
to_reference
(
@issue
.
project
)
}.
sort
.
to_sentence
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