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
1f24873e
Commit
1f24873e
authored
Oct 04, 2017
by
Jarka Kadlecova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't create todos for old issue assignees
parent
dda69dbc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
5 deletions
+35
-5
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+1
-1
app/services/todo_service.rb
app/services/todo_service.rb
+5
-4
changelogs/unreleased-ee/3642-assignees-todo-fix.yml
changelogs/unreleased-ee/3642-assignees-todo-fix.yml
+5
-0
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+24
-0
No files found.
app/services/issues/update_service.rb
View file @
1f24873e
...
...
@@ -34,7 +34,7 @@ module Issues
if
issue
.
assignees
!=
old_assignees
create_assignee_note
(
issue
,
old_assignees
)
notification_service
.
reassigned_issue
(
issue
,
current_user
,
old_assignees
)
todo_service
.
reassigned_issue
(
issue
,
current_user
)
todo_service
.
reassigned_issue
(
issue
,
current_user
,
old_assignees
)
end
if
issue
.
previous_changes
.
include?
(
'confidential'
)
...
...
app/services/todo_service.rb
View file @
1f24873e
...
...
@@ -43,8 +43,8 @@ class TodoService
#
# * create a pending todo for new assignee if issue is assigned
#
def
reassigned_issue
(
issue
,
current_user
)
create_assignment_todo
(
issue
,
current_user
)
def
reassigned_issue
(
issue
,
current_user
,
old_assignees
=
[]
)
create_assignment_todo
(
issue
,
current_user
,
old_assignees
)
end
# When create a merge request we should:
...
...
@@ -267,10 +267,11 @@ class TodoService
create_mention_todos
(
project
,
target
,
author
,
note
,
skip_users
)
end
def
create_assignment_todo
(
issuable
,
author
)
def
create_assignment_todo
(
issuable
,
author
,
old_assignees
=
[]
)
if
issuable
.
assignees
.
any?
assignees
=
issuable
.
assignees
-
old_assignees
attributes
=
attributes_for_todo
(
issuable
.
project
,
issuable
,
author
,
Todo
::
ASSIGNED
)
create_todos
(
issuable
.
assignees
,
attributes
)
create_todos
(
assignees
,
attributes
)
end
end
...
...
changelogs/unreleased-ee/3642-assignees-todo-fix.yml
0 → 100644
View file @
1f24873e
---
title
:
Don't create todos for old issue assignees
merge_request
:
author
:
type
:
fixed
spec/services/issues/update_service_spec.rb
View file @
1f24873e
...
...
@@ -257,6 +257,30 @@ describe Issues::UpdateService, :mailer do
end
end
context
'when a new assignee added'
do
subject
{
update_issue
(
assignees:
issue
.
assignees
+
[
user2
])
}
it
'creates only 1 new todo'
do
expect
{
subject
}.
to
change
{
Todo
.
count
}.
by
(
1
)
end
it
'creates a todo for new assignee'
do
subject
attributes
=
{
project:
project
,
author:
user
,
user:
user2
,
target_id:
issue
.
id
,
target_type:
issue
.
class
.
name
,
action:
Todo
::
ASSIGNED
,
state: :pending
}
expect
(
Todo
.
where
(
attributes
).
count
).
to
eq
(
1
)
end
end
context
'when the milestone change'
do
it
'marks todos as done'
do
update_issue
(
milestone:
create
(
:milestone
))
...
...
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