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
44656136
Commit
44656136
authored
Feb 18, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicit mention of the assignee make a task
Since potentially the previous assign-task has already been handled.
parent
424cb9cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
app/services/task_service.rb
app/services/task_service.rb
+5
-6
spec/services/task_service_spec.rb
spec/services/task_service_spec.rb
+4
-4
No files found.
app/services/task_service.rb
View file @
44656136
...
...
@@ -150,7 +150,6 @@ class TaskService
end
mentioned_users
.
delete
(
author
)
mentioned_users
.
delete
(
target
.
assignee
)
if
target
.
respond_to?
(
:assignee
)
mentioned_users
.
uniq
end
...
...
@@ -177,6 +176,7 @@ class TaskService
end
mentioned_users
=
build_mentioned_users
(
project
,
target
,
author
)
mentioned_users
.
delete
(
issuable
.
assignee
)
mentioned_users
.
each
do
|
mentioned_user
|
create_task
(
project
,
target
,
author
,
mentioned_user
,
Task
::
MENTIONED
)
...
...
@@ -185,16 +185,15 @@ class TaskService
def
update_issuable
(
issuable
,
current_user
)
project
=
issuable
.
project
target
=
issuable
author
=
current_user
mark_pending_tasks_as_done
(
target
,
author
)
mark_pending_tasks_as_done
(
issuable
,
author
)
mentioned_users
=
build_mentioned_users
(
project
,
target
,
author
)
mentioned_users
=
build_mentioned_users
(
project
,
issuable
,
author
)
mentioned_users
.
each
do
|
mentioned_user
|
unless
pending_tasks
(
mentioned_user
,
project
,
target
,
action:
Task
::
MENTIONED
).
exists?
create_task
(
project
,
target
,
author
,
mentioned_user
,
Task
::
MENTIONED
)
unless
pending_tasks
(
mentioned_user
,
project
,
issuable
,
action:
Task
::
MENTIONED
).
exists?
create_task
(
project
,
issuable
,
author
,
mentioned_user
,
Task
::
MENTIONED
)
end
end
end
...
...
spec/services/task_service_spec.rb
View file @
44656136
...
...
@@ -56,15 +56,15 @@ describe TaskService, services: true do
service
.
update_issue
(
issue
,
author
)
should_create_task
(
user:
michael
,
target:
issue
,
action:
Task
::
MENTIONED
)
should_create_task
(
user:
john_doe
,
target:
issue
,
action:
Task
::
MENTIONED
)
should_not_create_task
(
user:
author
,
target:
issue
,
action:
Task
::
MENTIONED
)
should_not_create_task
(
user:
john_doe
,
target:
issue
,
action:
Task
::
MENTIONED
)
should_not_create_task
(
user:
stranger
,
target:
issue
,
action:
Task
::
MENTIONED
)
end
it
'does not create a task if user was already mentioned'
do
create
(
:task
,
:mentioned
,
user:
michael
,
project:
project
,
target:
issue
,
author:
author
)
should_not_create_any_task
{
service
.
update_issue
(
issue
,
author
)
}
expect
{
service
.
update_issue
(
issue
,
author
)
}.
not_to
change
(
michael
.
tasks
,
:count
)
end
end
...
...
@@ -184,15 +184,15 @@ describe TaskService, services: true do
service
.
update_merge_request
(
mr_assigned
,
author
)
should_create_task
(
user:
michael
,
target:
mr_assigned
,
action:
Task
::
MENTIONED
)
should_create_task
(
user:
john_doe
,
target:
mr_assigned
,
action:
Task
::
MENTIONED
)
should_not_create_task
(
user:
author
,
target:
mr_assigned
,
action:
Task
::
MENTIONED
)
should_not_create_task
(
user:
john_doe
,
target:
mr_assigned
,
action:
Task
::
MENTIONED
)
should_not_create_task
(
user:
stranger
,
target:
mr_assigned
,
action:
Task
::
MENTIONED
)
end
it
'does not create a task if user was already mentioned'
do
create
(
:task
,
:mentioned
,
user:
michael
,
project:
project
,
target:
mr_assigned
,
author:
author
)
should_not_create_any_task
{
service
.
update_merge_request
(
mr_assigned
,
author
)
}
expect
{
service
.
update_merge_request
(
mr_assigned
,
author
)
}.
not_to
change
(
michael
.
tasks
,
:count
)
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