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
Léo-Paul Géneau
gitlab-ce
Commits
86446846
Commit
86446846
authored
Jul 27, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for resolving comments feature
parent
b53ccd11
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
383 additions
and
30 deletions
+383
-30
app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
...vascripts/diff_notes/components/jump_to_discussion.js.es6
+0
-6
app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
...ascripts/diff_notes/components/resolve_comment_btn.js.es6
+2
-1
app/assets/javascripts/diff_notes/services/resolve.js.es6
app/assets/javascripts/diff_notes/services/resolve.js.es6
+2
-1
app/assets/javascripts/diff_notes/stores/comments.js.es6
app/assets/javascripts/diff_notes/stores/comments.js.es6
+2
-1
app/assets/javascripts/merge_request_tabs.js
app/assets/javascripts/merge_request_tabs.js
+2
-2
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+4
-4
app/assets/stylesheets/pages/notes.scss
app/assets/stylesheets/pages/notes.scss
+2
-2
app/views/discussions/_jump_to_next.html.haml
app/views/discussions/_jump_to_next.html.haml
+1
-2
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+10
-11
spec/features/merge_requests/diff_notes_resolve_spec.rb
spec/features/merge_requests/diff_notes_resolve_spec.rb
+358
-0
No files found.
app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
View file @
86446846
...
@@ -24,12 +24,6 @@
...
@@ -24,12 +24,6 @@
}
}
return allResolved;
return allResolved;
},
isLast: function () {
const discussionKeys = Object.keys(this.discussions),
indexOfDiscussion = discussionKeys.indexOf(this.discussionId);
return discussionKeys.length - 1 === indexOfDiscussion;
}
}
},
},
methods: {
methods: {
...
...
app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
View file @
86446846
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
discussion = CommentsStore.state[this.discussionId];
discussion = CommentsStore.state[this.discussionId];
let allResolved = true;
let allResolved = true;
for (const noteId of notes) {
for (let i = 0; i < notes.length; i++) {
const noteId = notes[i];
const note = discussion[noteId];
const note = discussion[noteId];
if (!note.resolved) {
if (!note.resolved) {
...
...
app/assets/javascripts/diff_notes/services/resolve.js.es6
View file @
86446846
...
@@ -27,7 +27,8 @@
...
@@ -27,7 +27,8 @@
const noteIds = CommentsStore.notesForDiscussion(discussionId);
const noteIds = CommentsStore.notesForDiscussion(discussionId);
let isResolved = true;
let isResolved = true;
for (const noteId of noteIds) {
for (let i = 0; i < noteIds.length; i++) {
const noteId = noteIds[i];
const resolved = CommentsStore.state[discussionId][noteId].resolved;
const resolved = CommentsStore.state[discussionId][noteId].resolved;
if (!resolved) {
if (!resolved) {
...
...
app/assets/javascripts/diff_notes/stores/comments.js.es6
View file @
86446846
...
@@ -28,7 +28,8 @@
...
@@ -28,7 +28,8 @@
updateCommentsForDiscussion: function (discussionId, resolve, user) {
updateCommentsForDiscussion: function (discussionId, resolve, user) {
const noteIds = CommentsStore.resolvedNotesForDiscussion(discussionId, resolve);
const noteIds = CommentsStore.resolvedNotesForDiscussion(discussionId, resolve);
for (const noteId of noteIds) {
for (let i = 0; i < noteIds.length; i++) {
const noteId = noteIds[i];
CommentsStore.update(discussionId, noteId, resolve, user);
CommentsStore.update(discussionId, noteId, resolve, user);
}
}
},
},
...
...
app/assets/javascripts/merge_request_tabs.js
View file @
86446846
...
@@ -120,8 +120,8 @@
...
@@ -120,8 +120,8 @@
return
function
(
data
)
{
return
function
(
data
)
{
$
(
'
#diffs
'
).
html
(
data
.
html
);
$
(
'
#diffs
'
).
html
(
data
.
html
);
if
(
$
(
'
resolve-btn, resolve-all-btn
'
).
length
&&
(
typeof
DiffNotesApp
!==
"
undefined
"
&&
DiffNotesApp
!==
null
))
{
if
(
$
(
'
resolve-btn, resolve-all-btn
, jump-to-discussion
'
).
length
&&
(
typeof
DiffNotesApp
!==
"
undefined
"
&&
DiffNotesApp
!==
null
))
{
$
(
'
resolve-btn, resolve-all-btn
'
).
each
(
function
()
{
$
(
'
resolve-btn, resolve-all-btn
, jump-to-discussion
'
).
each
(
function
()
{
DiffNotesApp
.
$compile
(
$
(
this
).
get
(
0
))
DiffNotesApp
.
$compile
(
$
(
this
).
get
(
0
))
});
});
}
}
...
...
app/assets/javascripts/notes.js
View file @
86446846
...
@@ -429,7 +429,7 @@
...
@@ -429,7 +429,7 @@
$html
.
find
(
'
.js-task-list-container
'
).
taskList
(
'
enable
'
);
$html
.
find
(
'
.js-task-list-container
'
).
taskList
(
'
enable
'
);
$note_li
=
$
(
'
.note-row-
'
+
note
.
id
);
$note_li
=
$
(
'
.note-row-
'
+
note
.
id
);
if
(
DiffNotesApp
!
=
null
)
{
if
(
typeof
DiffNotesApp
!==
"
undefined
"
&&
DiffNotesApp
!=
=
null
)
{
ref
=
DiffNotesApp
.
$refs
[
''
+
note
.
id
+
''
];
ref
=
DiffNotesApp
.
$refs
[
''
+
note
.
id
+
''
];
if
(
ref
)
{
if
(
ref
)
{
...
@@ -525,7 +525,7 @@
...
@@ -525,7 +525,7 @@
note
=
$
(
el
);
note
=
$
(
el
);
notes
=
note
.
closest
(
"
.notes
"
);
notes
=
note
.
closest
(
"
.notes
"
);
if
(
DiffNotesApp
!
=
null
)
{
if
(
typeof
DiffNotesApp
!==
"
undefined
"
&&
DiffNotesApp
!=
=
null
)
{
ref
=
DiffNotesApp
.
$refs
[
''
+
noteId
+
''
];
ref
=
DiffNotesApp
.
$refs
[
''
+
noteId
+
''
];
if
(
ref
)
{
if
(
ref
)
{
...
@@ -604,10 +604,10 @@
...
@@ -604,10 +604,10 @@
if
(
canResolve
===
'
false
'
)
{
if
(
canResolve
===
'
false
'
)
{
form
.
find
(
'
resolve-comment-btn
'
).
remove
();
form
.
find
(
'
resolve-comment-btn
'
).
remove
();
}
else
if
(
DiffNotesApp
)
{
}
else
if
(
typeof
DiffNotesApp
!==
"
undefined
"
&&
DiffNotesApp
!==
null
)
{
var
$commentBtn
=
form
.
find
(
'
resolve-comment-btn
'
);
var
$commentBtn
=
form
.
find
(
'
resolve-comment-btn
'
);
$commentBtn
$commentBtn
.
attr
(
'
:discussion-id
'
,
dataHolder
.
data
(
'
discussionId
'
)
);
.
attr
(
'
:discussion-id
'
,
"
'
"
+
dataHolder
.
data
(
'
discussionId
'
)
+
"
'
"
);
DiffNotesApp
.
$compile
(
$commentBtn
.
get
(
0
));
DiffNotesApp
.
$compile
(
$commentBtn
.
get
(
0
));
}
}
...
...
app/assets/stylesheets/pages/notes.scss
View file @
86446846
...
@@ -454,13 +454,13 @@ ul.notes {
...
@@ -454,13 +454,13 @@ ul.notes {
position
:
relative
;
position
:
relative
;
top
:
2px
;
top
:
2px
;
font-size
:
8px
;
font-size
:
8px
;
color
:
#c3c3c3
;
color
:
$notes-action-color
;
vertical-align
:
top
;
vertical-align
:
top
;
}
}
}
}
.discussion-next-btn
{
.discussion-next-btn
{
path
{
path
{
fill
:
#7E7E7E
;
fill
:
$gray-darkest
;
}
}
}
}
app/views/discussions/_jump_to_next.html.haml
View file @
86446846
-
discussion
=
local_assigns
.
fetch
(
:discussion
,
false
)
-
discussion
=
local_assigns
.
fetch
(
:discussion
,
false
)
%jump-to-discussion
{
"inline-template"
=>
true
,
":discussion-id"
=>
"'#{discussion.try(:id)}'"
}
%jump-to-discussion
{
"inline-template"
=>
true
,
":discussion-id"
=>
"'#{discussion.try(:id)}'"
}
.btn-group
{
role:
"group"
,
.btn-group
{
role:
"group"
,
"v-show"
=>
"!allResolved"
,
"v-show"
=>
"!allResolved"
}
"v-if"
=>
"!isLast"
}
%button
.btn.btn-default.discussion-next-btn.has-tooltip
{
"@click"
=>
"jumpToNextUnresolvedDiscussion"
,
%button
.btn.btn-default.discussion-next-btn.has-tooltip
{
"@click"
=>
"jumpToNextUnresolvedDiscussion"
,
title:
"Jump to next unresolved discussion"
,
title:
"Jump to next unresolved discussion"
,
"aria-label"
=>
"Jump to next unresolved discussion"
,
"aria-label"
=>
"Jump to next unresolved discussion"
,
...
...
app/views/projects/merge_requests/_show.html.haml
View file @
86446846
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
=
succeed
'.'
do
=
succeed
'.'
do
=
link_to
"command line"
,
"#modal_merge_info"
,
class:
"how_to_merge_link vlink"
,
title:
"How To Merge"
,
"data-toggle"
=>
"modal"
=
link_to
"command line"
,
"#modal_merge_info"
,
class:
"how_to_merge_link vlink"
,
title:
"How To Merge"
,
"data-toggle"
=>
"modal"
-
if
current_user
#resolve-count-app
.line-resolve-all-container
{
"v-cloak"
=>
true
}
#resolve-count-app
.line-resolve-all-container
{
"v-cloak"
=>
true
}
%resolve-count
{
"inline-template"
=>
true
}
%resolve-count
{
"inline-template"
=>
true
}
.line-resolve-all
{
"v-show"
=>
"discussionCount > 0"
,
.line-resolve-all
{
"v-show"
=>
"discussionCount > 0"
,
...
@@ -53,7 +52,7 @@
...
@@ -53,7 +52,7 @@
":class"
=>
"{ 'is-active': resolved === discussionCount }"
}
":class"
=>
"{ 'is-active': resolved === discussionCount }"
}
=
icon
(
"check"
)
=
icon
(
"check"
)
%span
.line-resolve-text
%span
.line-resolve-text
{{ resolved }}/{{ discussionCount }} discussions
resolved
{{ resolved }}/{{ discussionCount }} {{ discussionCount | pluralize 'discussion' }}
resolved
=
render
"discussions/jump_to_next"
=
render
"discussions/jump_to_next"
-
if
@commits_count
.
nonzero?
-
if
@commits_count
.
nonzero?
...
...
spec/features/merge_requests/diff_notes_resolve_spec.rb
0 → 100644
View file @
86446846
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