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
Jérome Perrin
gitlab-ce
Commits
5e860656
Commit
5e860656
authored
Jul 26, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to toggle resolving by commenting
parent
6537a4a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
16 deletions
+41
-16
app/assets/javascripts/diff_notes/components/resolve_all_btn.js.es6
.../javascripts/diff_notes/components/resolve_all_btn.js.es6
+1
-9
app/assets/javascripts/diff_notes/services/resolve.js.es6
app/assets/javascripts/diff_notes/services/resolve.js.es6
+19
-0
app/assets/javascripts/diff_notes/stores/comments.js.es6
app/assets/javascripts/diff_notes/stores/comments.js.es6
+11
-2
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+8
-4
app/views/projects/merge_requests/_discussion.html.haml
app/views/projects/merge_requests/_discussion.html.haml
+1
-1
app/views/projects/notes/_form.html.haml
app/views/projects/notes/_form.html.haml
+1
-0
No files found.
app/assets/javascripts/diff_notes/components/resolve_all_btn.js.es6
View file @
5e860656
...
...
@@ -40,15 +40,7 @@
},
methods: {
resolve: function () {
let promise;
if (this.allResolved) {
promise = ResolveService
.unResolveAll(this.namespace, this.mergeRequestId, this.discussionId);
} else {
promise = ResolveService
.resolveAll(this.namespace, this.mergeRequestId, this.discussionId);
}
ResolveService.toggleResolveForDiscussion(this.namespace, this.mergeRequestId, this.discussionId);
}
}
});
...
...
app/assets/javascripts/diff_notes/services/resolve.js.es6
View file @
5e860656
...
...
@@ -23,6 +23,25 @@
return this.noteResource.delete({ noteId }, {});
}
toggleResolveForDiscussion(namespace, mergeRequestId, discussionId) {
const noteIds = CommentsStore.notesForDiscussion(discussionId);
let isResolved = true;
for (const noteId of noteIds) {
const resolved = CommentsStore.state[discussionId][noteId];
if (!resolved) {
isResolved = false;
}
}
if (isResolved) {
return this.unResolveAll(namespace, mergeRequestId, discussionId);
} else {
return this.resolveAll(namespace, mergeRequestId, discussionId);
}
}
resolveAll(namespace, mergeRequestId, discussionId) {
this.setCSRF();
Vue.http.options.root = `/${namespace}`;
...
...
app/assets/javascripts/diff_notes/stores/comments.js.es6
View file @
5e860656
...
...
@@ -25,13 +25,22 @@
}
},
updateCommentsForDiscussion: function (discussionId, resolve) {
const noteIds = CommentsStore.
n
otesForDiscussion(discussionId, resolve);
const noteIds = CommentsStore.
resolvedN
otesForDiscussion(discussionId, resolve);
for (const noteId of noteIds) {
CommentsStore.update(discussionId, noteId, resolve);
}
},
notesForDiscussion: function (discussionId, resolve) {
notesForDiscussion: function (discussionId) {
let ids = [];
for (const noteId in CommentsStore.state[discussionId]) {
ids.push(noteId);
}
return ids;
},
resolvedNotesForDiscussion: function (discussionId, resolve) {
let ids = [];
for (const noteId in CommentsStore.state[discussionId]) {
...
...
app/assets/javascripts/notes.js
View file @
5e860656
...
...
@@ -401,11 +401,14 @@
this
.
removeDiscussionNoteForm
(
$form
);
if
(
$form
.
attr
(
'
data-resolve-all
'
)
!=
null
)
{
var
namespace
=
$form
.
attr
(
'
data-namespace
'
),
discussionId
=
$form
.
attr
(
'
data-discussion-id
'
);
var
namespacePath
=
$form
.
attr
(
'
data-namespace-path
'
),
projectPath
=
$form
.
attr
(
'
data-project-path
'
)
discussionId
=
$form
.
attr
(
'
data-discussion-id
'
),
mergeRequestId
=
$
(
'
input[name="noteable_iid"]
'
,
$form
).
val
(),
namespace
=
`
${
namespacePath
}
/
${
projectPath
}
`
;
if
(
ResolveService
!=
null
)
{
ResolveService
.
resolveAll
(
namespace
,
discussionId
,
false
)
ResolveService
.
toggleResolveForDiscussion
(
namespace
,
mergeRequestId
,
discussionId
);
}
}
};
...
...
@@ -771,7 +774,8 @@
.
closest
(
'
form
'
)
.
attr
(
'
data-discussion-id
'
,
discussionId
)
.
attr
(
'
data-resolve-all
'
,
'
true
'
)
.
attr
(
'
data-namespace
'
,
$this
.
attr
(
'
data-namespace
'
));
.
attr
(
'
data-namespace-path
'
,
$this
.
attr
(
'
data-namespace-path
'
))
.
attr
(
'
data-project-path
'
,
$this
.
attr
(
'
data-project-path
'
));
};
return
Notes
;
...
...
app/views/projects/merge_requests/_discussion.html.haml
View file @
5e860656
...
...
@@ -4,6 +4,6 @@
=
link_to
'Close merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :close
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-close close-mr-link js-note-target-close"
,
title:
"Close merge request"
,
data:
{
original_text:
"Close merge request"
,
alternative_text:
"Comment & close merge request"
}
-
if
@merge_request
.
closed?
=
link_to
'Reopen merge request'
,
merge_request_path
(
@merge_request
,
merge_request:
{
state_event: :reopen
}),
method: :put
,
class:
"btn btn-nr btn-comment btn-reopen reopen-mr-link js-note-target-reopen"
,
title:
"Reopen merge request"
,
data:
{
original_text:
"Reopen merge request"
,
alternative_text:
"Comment & reopen merge request"
}
=
submit_tag
'Comment & resolve discussion'
,
class:
"btn btn-nr btn-create append-right-10 comment-btn js-comment-resolve-button"
,
data:
{
namespace
:
"
#{
@merge_request
.
project
.
namespace
.
path
}
/
#{
@merge_request
.
project
.
path
}
"
}
=
submit_tag
'Comment & resolve discussion'
,
class:
"btn btn-nr btn-create append-right-10 comment-btn js-comment-resolve-button"
,
data:
{
namespace
_path:
"
#{
@merge_request
.
project
.
namespace
.
path
}
"
,
project_path:
"
#{
@merge_request
.
project
.
path
}
"
}
#notes
=
render
"projects/notes/notes_with_form"
app/views/projects/notes/_form.html.haml
View file @
5e860656
...
...
@@ -5,6 +5,7 @@
=
f
.
hidden_field
:commit_id
=
f
.
hidden_field
:line_code
=
f
.
hidden_field
:noteable_id
=
hidden_field_tag
:noteable_iid
,
@note
.
noteable
.
iid
=
f
.
hidden_field
:noteable_type
=
f
.
hidden_field
:type
=
f
.
hidden_field
:position
...
...
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