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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
372cdf4c
Commit
372cdf4c
authored
Feb 16, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Marks pending tasks for an user as done when he merge the MR
parent
c86b12bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
app/services/merge_requests/post_merge_service.rb
app/services/merge_requests/post_merge_service.rb
+1
-0
app/services/task_service.rb
app/services/task_service.rb
+8
-0
spec/services/task_service_spec.rb
spec/services/task_service_spec.rb
+17
-0
No files found.
app/services/merge_requests/post_merge_service.rb
View file @
372cdf4c
...
...
@@ -11,6 +11,7 @@ module MergeRequests
create_merge_event
(
merge_request
,
current_user
)
create_note
(
merge_request
)
notification_service
.
merge_mr
(
merge_request
,
current_user
)
task_service
.
merge_merge_request
(
merge_request
,
current_user
)
execute_hooks
(
merge_request
,
'merge'
)
end
...
...
app/services/task_service.rb
View file @
372cdf4c
...
...
@@ -54,6 +54,14 @@ class TaskService
reassigned_issuable
(
merge_request
,
current_user
)
end
# When merge a merge request we should:
#
# * mark all pending tasks related to the target for the current user as done
#
def
merge_merge_request
(
merge_request
,
current_user
)
mark_as_done
(
merge_request
,
current_user
)
end
# When we mark a task as done we should:
#
# * mark all pending tasks related to the target for the user as done
...
...
spec/services/task_service_spec.rb
View file @
372cdf4c
...
...
@@ -167,6 +167,23 @@ describe TaskService, services: true do
is_expected_to_not_create_task
{
service
.
reassigned_merge_request
(
mr_assigned
,
author
)
}
end
end
describe
'#merge_merge_request'
do
let!
(
:first_pending_task
)
do
create
(
:pending_assigned_task
,
user:
john_doe
,
project:
project
,
target:
mr_assigned
,
author:
author
)
end
let!
(
:second_pending_task
)
do
create
(
:pending_assigned_task
,
user:
john_doe
,
project:
project
,
target:
mr_assigned
,
author:
author
)
end
it
'marks related pending tasks to the target for the user as done'
do
service
.
merge_merge_request
(
mr_assigned
,
john_doe
)
expect
(
first_pending_task
.
reload
).
to
be_done
expect
(
second_pending_task
.
reload
).
to
be_done
end
end
end
def
is_expected_to_create_pending_task
(
attributes
=
{})
...
...
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