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
9436579b
Commit
9436579b
authored
Jul 03, 2018
by
Jarka Kadlecová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark todos as done when epic was relabeled
parent
50b1b777
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
8 deletions
+53
-8
ee/app/services/epics/update_service.rb
ee/app/services/epics/update_service.rb
+5
-0
ee/spec/services/epics/update_service_spec.rb
ee/spec/services/epics/update_service_spec.rb
+48
-8
No files found.
ee/app/services/epics/update_service.rb
View file @
9436579b
...
...
@@ -9,6 +9,11 @@ module Epics
def
handle_changes
(
epic
,
options
)
old_associations
=
options
.
fetch
(
:old_associations
,
{})
old_mentioned_users
=
old_associations
.
fetch
(
:mentioned_users
,
[])
old_labels
=
old_associations
.
fetch
(
:labels
,
[])
if
has_changes?
(
epic
,
old_labels:
old_labels
)
todo_service
.
mark_pending_todos_as_done
(
epic
,
current_user
)
end
todo_service
.
update_epic
(
epic
,
current_user
,
old_mentioned_users
)
end
...
...
ee/spec/services/epics/update_service_spec.rb
View file @
9436579b
...
...
@@ -61,18 +61,58 @@ describe Epics::UpdateService do
end
context
'todos'
do
let
(
:mentioned1
)
{
create
(
:user
)
}
let
(
:mentioned2
)
{
create
(
:user
)
}
before
do
group
.
update
(
visibility:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
epic
.
update
(
description:
"FYI:
#{
mentioned1
.
to_reference
}
"
)
end
it
'creates todos for only newly mentioned users'
do
expect
do
update_epic
(
description:
"FYI:
#{
mentioned1
.
to_reference
}
#{
mentioned2
.
to_reference
}
"
)
end
.
to
change
{
Todo
.
count
}.
by
(
1
)
context
'creating todos'
do
let
(
:mentioned1
)
{
create
(
:user
)
}
let
(
:mentioned2
)
{
create
(
:user
)
}
before
do
epic
.
update
(
description:
"FYI:
#{
mentioned1
.
to_reference
}
"
)
end
it
'creates todos for only newly mentioned users'
do
expect
do
update_epic
(
description:
"FYI:
#{
mentioned1
.
to_reference
}
#{
mentioned2
.
to_reference
}
"
)
end
.
to
change
{
Todo
.
count
}.
by
(
1
)
end
end
context
'adding a label'
do
let
(
:label
)
{
create
(
:group_label
,
group:
group
)
}
let
(
:user2
)
{
create
(
:user
)
}
let!
(
:todo1
)
do
create
(
:todo
,
:mentioned
,
:pending
,
target:
epic
,
group:
group
,
project:
nil
,
author:
user
,
user:
user
)
end
let!
(
:todo2
)
do
create
(
:todo
,
:mentioned
,
:pending
,
target:
epic
,
group:
group
,
project:
nil
,
author:
user2
,
user:
user2
)
end
before
do
group
.
add_developer
(
user
)
update_epic
(
label_ids:
[
label
.
id
])
end
it
'marks todo as done for a user who added a label'
do
expect
(
todo1
.
reload
.
state
).
to
eq
(
'done'
)
end
it
'does not mark todos as done for other users'
do
expect
(
todo2
.
reload
.
state
).
to
eq
(
'pending'
)
end
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