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
d30e1f5c
Commit
d30e1f5c
authored
Oct 08, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7983 from cirosantilli/factor-issue-mr-service
Factor issue and merge request services
parents
ac7fab73
23b4a2e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
20 deletions
+15
-20
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+13
-0
app/services/issues/base_service.rb
app/services/issues/base_service.rb
+1
-9
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+1
-11
No files found.
app/services/issuable_base_service.rb
0 → 100644
View file @
d30e1f5c
class
IssuableBaseService
<
BaseService
private
def
create_assignee_note
(
issuable
)
Note
.
create_assignee_change_note
(
issuable
,
issuable
.
project
,
current_user
,
issuable
.
assignee
)
end
def
create_milestone_note
(
issuable
)
Note
.
create_milestone_change_note
(
issuable
,
issuable
.
project
,
current_user
,
issuable
.
milestone
)
end
end
app/services/issues/base_service.rb
View file @
d30e1f5c
module
Issues
class
BaseService
<
::
BaseService
class
BaseService
<
::
Issuable
BaseService
private
def
create_assignee_note
(
issue
)
Note
.
create_assignee_change_note
(
issue
,
issue
.
project
,
current_user
,
issue
.
assignee
)
end
def
execute_hooks
(
issue
,
action
=
'open'
)
issue_data
=
issue
.
to_hook_data
issue_url
=
Gitlab
::
UrlBuilder
.
new
(
:issue
).
build
(
issue
.
id
)
issue_data
[
:object_attributes
].
merge!
(
url:
issue_url
,
action:
action
)
issue
.
project
.
execute_hooks
(
issue_data
,
:issue_hooks
)
end
def
create_milestone_note
(
issue
)
Note
.
create_milestone_change_note
(
issue
,
issue
.
project
,
current_user
,
issue
.
milestone
)
end
end
end
app/services/merge_requests/base_service.rb
View file @
d30e1f5c
module
MergeRequests
class
BaseService
<
::
BaseService
private
def
create_assignee_note
(
merge_request
)
Note
.
create_assignee_change_note
(
merge_request
,
merge_request
.
project
,
current_user
,
merge_request
.
assignee
)
end
class
BaseService
<
::
IssuableBaseService
def
create_note
(
merge_request
)
Note
.
create_status_change_note
(
merge_request
,
merge_request
.
target_project
,
current_user
,
merge_request
.
state
,
nil
)
...
...
@@ -16,9 +10,5 @@ module MergeRequests
merge_request
.
project
.
execute_hooks
(
merge_request
.
to_hook_data
,
:merge_request_hooks
)
end
end
def
create_milestone_note
(
merge_request
)
Note
.
create_milestone_change_note
(
merge_request
,
merge_request
.
project
,
current_user
,
merge_request
.
milestone
)
end
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