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
0f24c922
Commit
0f24c922
authored
Jul 05, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE-specific lines from TodoService
parent
3194b956
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
app/services/todo_service.rb
app/services/todo_service.rb
+0
-18
ee/app/services/ee/todo_service.rb
ee/app/services/ee/todo_service.rb
+24
-0
No files found.
app/services/todo_service.rb
View file @
0f24c922
...
...
@@ -108,14 +108,6 @@ class TodoService
end
end
# When new approvers are added for a merge request:
#
# * create a todo for those users to approve the MR
#
def
add_merge_request_approvers
(
merge_request
,
approvers
)
create_approval_required_todos
(
merge_request
,
approvers
,
merge_request
.
author
)
end
# When a new commit is pushed to a merge request we should:
#
# * mark all pending todos related to the merge request for that user as done
...
...
@@ -237,11 +229,6 @@ class TodoService
def
new_issuable
(
issuable
,
author
)
create_assignment_todo
(
issuable
,
author
)
if
issuable
.
is_a?
(
MergeRequest
)
create_approval_required_todos
(
issuable
,
issuable
.
overall_approvers
,
author
)
end
create_mention_todos
(
issuable
.
project
,
issuable
,
author
)
end
...
...
@@ -287,11 +274,6 @@ class TodoService
create_todos
(
mentioned_users
,
attributes
)
end
def
create_approval_required_todos
(
merge_request
,
approvers
,
author
)
attributes
=
attributes_for_todo
(
merge_request
.
project
,
merge_request
,
author
,
Todo
::
APPROVAL_REQUIRED
)
create_todos
(
approvers
.
map
(
&
:user
),
attributes
)
end
def
create_build_failed_todo
(
merge_request
,
todo_author
)
attributes
=
attributes_for_todo
(
merge_request
.
project
,
merge_request
,
todo_author
,
Todo
::
BUILD_FAILED
)
create_todos
(
todo_author
,
attributes
)
...
...
ee/app/services/ee/todo_service.rb
View file @
0f24c922
...
...
@@ -2,6 +2,23 @@ module EE
module
TodoService
extend
::
Gitlab
::
Utils
::
Override
# When new approvers are added for a merge request:
#
# * create a todo for those users to approve the MR
#
def
add_merge_request_approvers
(
merge_request
,
approvers
)
create_approval_required_todos
(
merge_request
,
approvers
,
merge_request
.
author
)
end
override
:new_issuable
def
new_issuable
(
issuable
,
author
)
if
issuable
.
is_a?
(
MergeRequest
)
create_approval_required_todos
(
issuable
,
issuable
.
overall_approvers
,
author
)
end
super
end
def
new_epic
(
epic
,
current_user
)
create_mention_todos
(
nil
,
epic
,
current_user
)
end
...
...
@@ -10,6 +27,8 @@ module EE
create_mention_todos
(
nil
,
epic
,
current_user
,
nil
,
skip_users
)
end
private
override
:attributes_for_target
def
attributes_for_target
(
target
)
attributes
=
super
...
...
@@ -20,5 +39,10 @@ module EE
attributes
end
def
create_approval_required_todos
(
merge_request
,
approvers
,
author
)
attributes
=
attributes_for_todo
(
merge_request
.
project
,
merge_request
,
author
,
::
Todo
::
APPROVAL_REQUIRED
)
create_todos
(
approvers
.
map
(
&
:user
),
attributes
)
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