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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
6f9304e0
Commit
6f9304e0
authored
Mar 08, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a flash messages when an issue resolving discussions is created
parent
f8211588
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
1 deletion
+31
-1
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+7
-1
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+14
-0
spec/support/features/resolving_discussions_in_issues_shared_examples.rb
...atures/resolving_discussions_in_issues_shared_examples.rb
+10
-0
No files found.
app/controllers/projects/issues_controller.rb
View file @
6f9304e0
...
@@ -106,7 +106,13 @@ class Projects::IssuesController < Projects::ApplicationController
...
@@ -106,7 +106,13 @@ class Projects::IssuesController < Projects::ApplicationController
discussion_to_resolve:
params
[
:discussion_to_resolve
]
discussion_to_resolve:
params
[
:discussion_to_resolve
]
)
)
@issue
=
Issues
::
CreateService
.
new
(
project
,
current_user
,
create_params
).
execute
service
=
Issues
::
CreateService
.
new
(
project
,
current_user
,
create_params
)
@issue
=
service
.
execute
if
service
.
discussions_to_resolve
.
any?
&&
service
.
discussions_to_resolve
.
all?
(
&
:resolved?
)
resolve_count
=
service
.
discussions_to_resolve
.
size
flash
[
:notice
]
=
"Resolved
#{
resolve_count
}
#{
'discussion'
.
pluralize
(
resolve_count
)
}
."
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
6f9304e0
...
@@ -495,6 +495,20 @@ describe Projects::IssuesController do
...
@@ -495,6 +495,20 @@ describe Projects::IssuesController do
expect
(
discussion
.
resolved?
).
to
eq
(
true
)
expect
(
discussion
.
resolved?
).
to
eq
(
true
)
end
end
it
'sets a flash message'
do
post_issue
(
title:
'Hello'
)
expect
(
flash
[
:notice
]).
to
eq
(
'Resolved 1 discussion.'
)
end
it
'pluralizes the flash message when resolving multiple discussions'
do
create
(
:diff_note_on_merge_request
,
noteable:
merge_request
,
project:
project
,
line_number:
15
)
post_issue
(
title:
'Hello'
)
expect
(
flash
[
:notice
]).
to
eq
(
'Resolved 2 discussions.'
)
end
it
"resolves a single discussion"
do
it
"resolves a single discussion"
do
post_issue
(
other_params:
{
discussion_to_resolve:
discussion
.
id
})
post_issue
(
other_params:
{
discussion_to_resolve:
discussion
.
id
})
discussion
.
first_note
.
reload
discussion
.
first_note
.
reload
...
...
spec/support/features/resolving_discussions_in_issues_shared_examples.rb
View file @
6f9304e0
...
@@ -23,6 +23,16 @@ shared_examples 'creating an issue for a discussion' do
...
@@ -23,6 +23,16 @@ shared_examples 'creating an issue for a discussion' do
expect
(
discussion
.
resolved?
).
to
eq
(
true
)
expect
(
discussion
.
resolved?
).
to
eq
(
true
)
end
end
it
'shows a flash messaage after resolving a discussion'
do
click_button
'Submit issue'
page
.
within
'.flash-notice'
do
# Only check for the word 'Resolved' since the spec might have resolved
# multiple discussions
expect
(
page
).
to
have_content
(
'Resolved'
)
end
end
it
'has a hidden field for the merge request'
do
it
'has a hidden field for the merge request'
do
merge_request_field
=
find
(
'#merge_request_for_resolving_discussions'
,
visible:
false
)
merge_request_field
=
find
(
'#merge_request_for_resolving_discussions'
,
visible:
false
)
...
...
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