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
Jérome Perrin
gitlab-ce
Commits
23b4a2e7
Commit
23b4a2e7
authored
Oct 07, 2014
by
Ciro Santilli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor issue and merge request services
parent
bbc52b00
Changes
3
Show 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 @
23b4a2e7
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 @
23b4a2e7
module
Issues
module
Issues
class
BaseService
<
::
BaseService
class
BaseService
<
::
Issuable
BaseService
private
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'
)
def
execute_hooks
(
issue
,
action
=
'open'
)
issue_data
=
issue
.
to_hook_data
issue_data
=
issue
.
to_hook_data
issue_url
=
Gitlab
::
UrlBuilder
.
new
(
:issue
).
build
(
issue
.
id
)
issue_url
=
Gitlab
::
UrlBuilder
.
new
(
:issue
).
build
(
issue
.
id
)
issue_data
[
:object_attributes
].
merge!
(
url:
issue_url
,
action:
action
)
issue_data
[
:object_attributes
].
merge!
(
url:
issue_url
,
action:
action
)
issue
.
project
.
execute_hooks
(
issue_data
,
:issue_hooks
)
issue
.
project
.
execute_hooks
(
issue_data
,
:issue_hooks
)
end
end
def
create_milestone_note
(
issue
)
Note
.
create_milestone_change_note
(
issue
,
issue
.
project
,
current_user
,
issue
.
milestone
)
end
end
end
end
end
app/services/merge_requests/base_service.rb
View file @
23b4a2e7
module
MergeRequests
module
MergeRequests
class
BaseService
<
::
BaseService
class
BaseService
<
::
IssuableBaseService
private
def
create_assignee_note
(
merge_request
)
Note
.
create_assignee_change_note
(
merge_request
,
merge_request
.
project
,
current_user
,
merge_request
.
assignee
)
end
def
create_note
(
merge_request
)
def
create_note
(
merge_request
)
Note
.
create_status_change_note
(
merge_request
,
merge_request
.
target_project
,
current_user
,
merge_request
.
state
,
nil
)
Note
.
create_status_change_note
(
merge_request
,
merge_request
.
target_project
,
current_user
,
merge_request
.
state
,
nil
)
...
@@ -16,9 +10,5 @@ module MergeRequests
...
@@ -16,9 +10,5 @@ module MergeRequests
merge_request
.
project
.
execute_hooks
(
merge_request
.
to_hook_data
,
:merge_request_hooks
)
merge_request
.
project
.
execute_hooks
(
merge_request
.
to_hook_data
,
:merge_request_hooks
)
end
end
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
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