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
4bfc377f
Commit
4bfc377f
authored
Feb 17, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename TaskService#mark_as_done to mark_pending_tasks_as_done
parent
56a5fc0c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+1
-1
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+1
-1
app/services/task_service.rb
app/services/task_service.rb
+6
-6
spec/services/task_service_spec.rb
spec/services/task_service_spec.rb
+2
-2
No files found.
app/services/issues/update_service.rb
View file @
4bfc377f
...
@@ -6,7 +6,7 @@ module Issues
...
@@ -6,7 +6,7 @@ module Issues
def
handle_changes
(
issue
,
options
=
{})
def
handle_changes
(
issue
,
options
=
{})
if
have_changes?
(
issue
,
options
)
if
have_changes?
(
issue
,
options
)
task_service
.
mark_as_done
(
issue
,
current_user
)
task_service
.
mark_
pending_tasks_
as_done
(
issue
,
current_user
)
end
end
if
issue
.
previous_changes
.
include?
(
'milestone_id'
)
if
issue
.
previous_changes
.
include?
(
'milestone_id'
)
...
...
app/services/merge_requests/update_service.rb
View file @
4bfc377f
...
@@ -16,7 +16,7 @@ module MergeRequests
...
@@ -16,7 +16,7 @@ module MergeRequests
def
handle_changes
(
merge_request
,
options
=
{})
def
handle_changes
(
merge_request
,
options
=
{})
if
have_changes?
(
merge_request
,
options
)
if
have_changes?
(
merge_request
,
options
)
task_service
.
mark_as_done
(
merge_request
,
current_user
)
task_service
.
mark_
pending_tasks_
as_done
(
merge_request
,
current_user
)
end
end
if
merge_request
.
previous_changes
.
include?
(
'target_branch'
)
if
merge_request
.
previous_changes
.
include?
(
'target_branch'
)
...
...
app/services/task_service.rb
View file @
4bfc377f
...
@@ -19,7 +19,7 @@ class TaskService
...
@@ -19,7 +19,7 @@ class TaskService
# * mark all pending tasks related to the target for the current user as done
# * mark all pending tasks related to the target for the current user as done
#
#
def
close_issue
(
issue
,
current_user
)
def
close_issue
(
issue
,
current_user
)
mark_as_done
(
issue
,
current_user
)
mark_
pending_tasks_
as_done
(
issue
,
current_user
)
end
end
# When we reassign an issue we should:
# When we reassign an issue we should:
...
@@ -43,7 +43,7 @@ class TaskService
...
@@ -43,7 +43,7 @@ class TaskService
# * mark all pending tasks related to the target for the current user as done
# * mark all pending tasks related to the target for the current user as done
#
#
def
close_merge_request
(
merge_request
,
current_user
)
def
close_merge_request
(
merge_request
,
current_user
)
mark_as_done
(
merge_request
,
current_user
)
mark_
pending_tasks_
as_done
(
merge_request
,
current_user
)
end
end
# When we reassign a merge request we should:
# When we reassign a merge request we should:
...
@@ -59,14 +59,14 @@ class TaskService
...
@@ -59,14 +59,14 @@ class TaskService
# * mark all pending tasks related to the target for the current user as done
# * mark all pending tasks related to the target for the current user as done
#
#
def
merge_merge_request
(
merge_request
,
current_user
)
def
merge_merge_request
(
merge_request
,
current_user
)
mark_as_done
(
merge_request
,
current_user
)
mark_
pending_tasks_
as_done
(
merge_request
,
current_user
)
end
end
# When we mark a task as done we should:
# When we mark a task as done we should:
#
#
# * mark all pending tasks related to the target for the user as done
# * mark all pending tasks related to the target for the user as done
#
#
def
mark_as_done
(
target
,
user
)
def
mark_
pending_tasks_
as_done
(
target
,
user
)
pending_tasks
=
pending_tasks_for
(
user
,
target
.
project
,
target
)
pending_tasks
=
pending_tasks_for
(
user
,
target
.
project
,
target
)
pending_tasks
.
update_all
(
state: :done
)
pending_tasks
.
update_all
(
state: :done
)
end
end
...
@@ -78,7 +78,7 @@ class TaskService
...
@@ -78,7 +78,7 @@ class TaskService
def
new_note
(
note
)
def
new_note
(
note
)
# Skip system notes, like status changes and cross-references
# Skip system notes, like status changes and cross-references
unless
note
.
system
unless
note
.
system
mark_as_done
(
note
.
noteable
,
note
.
author
)
mark_
pending_tasks_
as_done
(
note
.
noteable
,
note
.
author
)
end
end
end
end
...
@@ -89,7 +89,7 @@ class TaskService
...
@@ -89,7 +89,7 @@ class TaskService
def
update_note
(
note
,
current_user
)
def
update_note
(
note
,
current_user
)
# Skip system notes, like status changes and cross-references
# Skip system notes, like status changes and cross-references
unless
note
.
system
unless
note
.
system
mark_as_done
(
note
.
noteable
,
current_user
)
mark_
pending_tasks_
as_done
(
note
.
noteable
,
current_user
)
end
end
end
end
...
...
spec/services/task_service_spec.rb
View file @
4bfc377f
...
@@ -63,7 +63,7 @@ describe TaskService, services: true do
...
@@ -63,7 +63,7 @@ describe TaskService, services: true do
end
end
end
end
describe
'#mark_as_done'
do
describe
'#mark_
pending_tasks_
as_done'
do
let!
(
:first_pending_task
)
do
let!
(
:first_pending_task
)
do
create
(
:pending_assigned_task
,
user:
john_doe
,
project:
project
,
target:
assigned_issue
,
author:
author
)
create
(
:pending_assigned_task
,
user:
john_doe
,
project:
project
,
target:
assigned_issue
,
author:
author
)
end
end
...
@@ -73,7 +73,7 @@ describe TaskService, services: true do
...
@@ -73,7 +73,7 @@ describe TaskService, services: true do
end
end
it
'marks related pending tasks to the target for the user as done'
do
it
'marks related pending tasks to the target for the user as done'
do
service
.
mark_as_done
(
assigned_issue
,
john_doe
)
service
.
mark_
pending_tasks_
as_done
(
assigned_issue
,
john_doe
)
expect
(
first_pending_task
.
reload
).
to
be_done
expect
(
first_pending_task
.
reload
).
to
be_done
expect
(
second_pending_task
.
reload
).
to
be_done
expect
(
second_pending_task
.
reload
).
to
be_done
...
...
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