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
Boxiang Sun
gitlab-ce
Commits
fa4a6135
Commit
fa4a6135
authored
8 years ago
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'Resolved all discussions' system note
parent
220b82a4
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
0 deletions
+28
-0
app/controllers/projects/discussions_controller.rb
app/controllers/projects/discussions_controller.rb
+2
-0
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+2
-0
app/models/merge_request.rb
app/models/merge_request.rb
+5
-0
app/services/merge_requests/all_discussions_resolved_service.rb
...rvices/merge_requests/all_discussions_resolved_service.rb
+9
-0
app/services/notes/delete_service.rb
app/services/notes/delete_service.rb
+4
-0
app/services/system_note_service.rb
app/services/system_note_service.rb
+6
-0
No files found.
app/controllers/projects/discussions_controller.rb
View file @
fa4a6135
...
@@ -9,6 +9,8 @@ class Projects::DiscussionsController < Projects::ApplicationController
...
@@ -9,6 +9,8 @@ class Projects::DiscussionsController < Projects::ApplicationController
discussion
.
resolve!
(
current_user
)
discussion
.
resolve!
(
current_user
)
MergeRequests
::
AllDiscussionsResolvedService
.
new
(
project
,
current_user
).
execute
(
merge_request
)
render
json:
{
render
json:
{
resolved_by:
discussion
.
resolved_by
.
try
(
:name
),
resolved_by:
discussion
.
resolved_by
.
try
(
:name
),
discussion_headline_html:
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
discussion_headline_html:
view_to_html_string
(
'discussions/_headline'
,
discussion:
discussion
)
...
...
This diff is collapsed.
Click to expand it.
app/controllers/projects/notes_controller.rb
View file @
fa4a6135
...
@@ -72,6 +72,8 @@ class Projects::NotesController < Projects::ApplicationController
...
@@ -72,6 +72,8 @@ class Projects::NotesController < Projects::ApplicationController
note
.
resolve!
(
current_user
)
note
.
resolve!
(
current_user
)
MergeRequests
::
AllDiscussionsResolvedService
.
new
(
project
,
current_user
).
execute
(
note
.
noteable
)
discussion
=
note
.
discussion
discussion
=
note
.
discussion
render
json:
{
render
json:
{
...
...
This diff is collapsed.
Click to expand it.
app/models/merge_request.rb
View file @
fa4a6135
...
@@ -401,6 +401,11 @@ class MergeRequest < ActiveRecord::Base
...
@@ -401,6 +401,11 @@ class MergeRequest < ActiveRecord::Base
discussions
discussions
end
end
def
discussions_resolved?
all_discussions
=
discussions
all_discussions
.
any?
(
&
:resolvable?
)
&&
all_discussions
.
none?
(
&
:to_be_resolved?
)
end
def
hook_attrs
def
hook_attrs
attrs
=
{
attrs
=
{
source:
source_project
.
try
(
:hook_attrs
),
source:
source_project
.
try
(
:hook_attrs
),
...
...
This diff is collapsed.
Click to expand it.
app/services/merge_requests/all_discussions_resolved_service.rb
0 → 100644
View file @
fa4a6135
module
MergeRequests
class
AllDiscussionsResolvedService
<
MergeRequests
::
BaseService
def
execute
(
merge_request
)
return
unless
merge_request
.
discussions_resolved?
SystemNoteService
.
resolve_all_discussions
(
merge_request
,
project
,
current_user
)
end
end
end
This diff is collapsed.
Click to expand it.
app/services/notes/delete_service.rb
View file @
fa4a6135
...
@@ -3,6 +3,10 @@ module Notes
...
@@ -3,6 +3,10 @@ module Notes
def
execute
(
note
)
def
execute
(
note
)
note
.
destroy
note
.
destroy
note
.
reset_events_cache
note
.
reset_events_cache
if
note
.
resolvable?
MergeRequests
::
AllDiscussionsResolvedService
.
new
(
project
,
current_user
).
execute
(
note
.
noteable
)
end
end
end
end
end
end
end
This diff is collapsed.
Click to expand it.
app/services/system_note_service.rb
View file @
fa4a6135
...
@@ -156,6 +156,12 @@ class SystemNoteService
...
@@ -156,6 +156,12 @@ class SystemNoteService
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
create_note
(
noteable:
noteable
,
project:
project
,
author:
author
,
note:
body
)
end
end
def
self
.
resolve_all_discussions
(
merge_request
,
project
,
author
)
body
=
"Resolved all discussions"
create_note
(
noteable:
merge_request
,
project:
project
,
author:
author
,
note:
body
)
end
# Called when the title of a Noteable is changed
# Called when the title of a Noteable is changed
#
#
# noteable - Noteable object that responds to `title`
# noteable - Noteable object that responds to `title`
...
...
This diff is collapsed.
Click to expand it.
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