summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-07-27 16:57:48 +0100
committerPhil Hughes <me@iamphill.com>2016-07-27 16:57:48 +0100
commit86446846e963ea1304b56fa74b4ca795a491bbb5 (patch)
tree5020febc504570b27d7692afa6834b1cc0e1ef04 /app
parentb53ccd112d10416f3dd4a1a661cdd4345ee89d9b (diff)
downloadgitlab-ce-86446846e963ea1304b56fa74b4ca795a491bbb5.tar.gz
Added tests for resolving comments feature
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es66
-rw-r--r--app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es63
-rw-r--r--app/assets/javascripts/diff_notes/services/resolve.js.es63
-rw-r--r--app/assets/javascripts/diff_notes/stores/comments.js.es63
-rw-r--r--app/assets/javascripts/merge_request_tabs.js4
-rw-r--r--app/assets/javascripts/notes.js8
-rw-r--r--app/assets/stylesheets/pages/notes.scss4
-rw-r--r--app/views/discussions/_jump_to_next.html.haml3
-rw-r--r--app/views/projects/merge_requests/_show.html.haml21
9 files changed, 25 insertions, 30 deletions
diff --git a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6 b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
index e85562454e3..3f107e26421 100644
--- a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
+++ b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
@@ -24,12 +24,6 @@
}
return allResolved;
- },
- isLast: function () {
- const discussionKeys = Object.keys(this.discussions),
- indexOfDiscussion = discussionKeys.indexOf(this.discussionId);
-
- return discussionKeys.length - 1 === indexOfDiscussion;
}
},
methods: {
diff --git a/app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6 b/app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
index 1ffe4cf99d6..897a7657bf6 100644
--- a/app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
+++ b/app/assets/javascripts/diff_notes/components/resolve_comment_btn.js.es6
@@ -9,7 +9,8 @@
discussion = CommentsStore.state[this.discussionId];
let allResolved = true;
- for (const noteId of notes) {
+ for (let i = 0; i < notes.length; i++) {
+ const noteId = notes[i];
const note = discussion[noteId];
if (!note.resolved) {
diff --git a/app/assets/javascripts/diff_notes/services/resolve.js.es6 b/app/assets/javascripts/diff_notes/services/resolve.js.es6
index 29de46f2dc7..28830f4af4e 100644
--- a/app/assets/javascripts/diff_notes/services/resolve.js.es6
+++ b/app/assets/javascripts/diff_notes/services/resolve.js.es6
@@ -27,7 +27,8 @@
const noteIds = CommentsStore.notesForDiscussion(discussionId);
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;
if (!resolved) {
diff --git a/app/assets/javascripts/diff_notes/stores/comments.js.es6 b/app/assets/javascripts/diff_notes/stores/comments.js.es6
index f42ed29b619..e199b774f59 100644
--- a/app/assets/javascripts/diff_notes/stores/comments.js.es6
+++ b/app/assets/javascripts/diff_notes/stores/comments.js.es6
@@ -28,7 +28,8 @@
updateCommentsForDiscussion: function (discussionId, resolve, user) {
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);
}
},
diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js
index 332288dcf8e..2343ace3b68 100644
--- a/app/assets/javascripts/merge_request_tabs.js
+++ b/app/assets/javascripts/merge_request_tabs.js
@@ -120,8 +120,8 @@
return function(data) {
$('#diffs').html(data.html);
- if ($('resolve-btn, resolve-all-btn').length && (typeof DiffNotesApp !== "undefined" && DiffNotesApp !== null)) {
- $('resolve-btn, resolve-all-btn').each(function () {
+ if ($('resolve-btn, resolve-all-btn, jump-to-discussion').length && (typeof DiffNotesApp !== "undefined" && DiffNotesApp !== null)) {
+ $('resolve-btn, resolve-all-btn, jump-to-discussion').each(function () {
DiffNotesApp.$compile($(this).get(0))
});
}
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 67ea47e67b2..5293e5f8dda 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -429,7 +429,7 @@
$html.find('.js-task-list-container').taskList('enable');
$note_li = $('.note-row-' + note.id);
- if (DiffNotesApp != null) {
+ if (typeof DiffNotesApp !== "undefined" && DiffNotesApp !== null) {
ref = DiffNotesApp.$refs['' + note.id + ''];
if (ref) {
@@ -525,7 +525,7 @@
note = $(el);
notes = note.closest(".notes");
- if (DiffNotesApp != null) {
+ if (typeof DiffNotesApp !== "undefined" && DiffNotesApp !== null) {
ref = DiffNotesApp.$refs['' + noteId + ''];
if (ref) {
@@ -604,10 +604,10 @@
if (canResolve === 'false') {
form.find('resolve-comment-btn').remove();
- } else if (DiffNotesApp) {
+ } else if (typeof DiffNotesApp !== "undefined" && DiffNotesApp !== null) {
var $commentBtn = form.find('resolve-comment-btn');
$commentBtn
- .attr(':discussion-id', dataHolder.data('discussionId'));
+ .attr(':discussion-id', "'" + dataHolder.data('discussionId') + "'");
DiffNotesApp.$compile($commentBtn.get(0));
}
diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss
index 6b34ab30121..c2762b3e3a1 100644
--- a/app/assets/stylesheets/pages/notes.scss
+++ b/app/assets/stylesheets/pages/notes.scss
@@ -454,13 +454,13 @@ ul.notes {
position: relative;
top: 2px;
font-size: 8px;
- color: #c3c3c3;
+ color: $notes-action-color;
vertical-align: top;
}
}
.discussion-next-btn {
path {
- fill: #7E7E7E;
+ fill: $gray-darkest;
}
}
diff --git a/app/views/discussions/_jump_to_next.html.haml b/app/views/discussions/_jump_to_next.html.haml
index 83c94b65ea3..dfdf6e60051 100644
--- a/app/views/discussions/_jump_to_next.html.haml
+++ b/app/views/discussions/_jump_to_next.html.haml
@@ -1,8 +1,7 @@
- discussion = local_assigns.fetch(:discussion, false)
%jump-to-discussion{ "inline-template" => true, ":discussion-id" => "'#{discussion.try(:id)}'" }
.btn-group{ role: "group",
- "v-show" => "!allResolved",
- "v-if" => "!isLast" }
+ "v-show" => "!allResolved" }
%button.btn.btn-default.discussion-next-btn.has-tooltip{ "@click" => "jumpToNextUnresolvedDiscussion",
title: "Jump to next unresolved discussion",
"aria-label" => "Jump to next unresolved discussion",
diff --git a/app/views/projects/merge_requests/_show.html.haml b/app/views/projects/merge_requests/_show.html.haml
index 6ad3b289c54..4e090e005c3 100644
--- a/app/views/projects/merge_requests/_show.html.haml
+++ b/app/views/projects/merge_requests/_show.html.haml
@@ -44,17 +44,16 @@
= succeed '.' do
= 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{ "inline-template" => true }
- .line-resolve-all{ "v-show" => "discussionCount > 0",
- ":class" => "{ 'has-next-btn': resolved !== discussionCount }" }
- %span.line-resolve-btn.is-disabled{ type: "button",
- ":class" => "{ 'is-active': resolved === discussionCount }" }
- = icon("check")
- %span.line-resolve-text
- {{ resolved }}/{{ discussionCount }} discussions resolved
- = render "discussions/jump_to_next"
+ #resolve-count-app.line-resolve-all-container{ "v-cloak" => true }
+ %resolve-count{ "inline-template" => true }
+ .line-resolve-all{ "v-show" => "discussionCount > 0",
+ ":class" => "{ 'has-next-btn': resolved !== discussionCount }" }
+ %span.line-resolve-btn.is-disabled{ type: "button",
+ ":class" => "{ 'is-active': resolved === discussionCount }" }
+ = icon("check")
+ %span.line-resolve-text
+ {{ resolved }}/{{ discussionCount }} {{ discussionCount | pluralize 'discussion' }} resolved
+ = render "discussions/jump_to_next"
- if @commits_count.nonzero?
%ul.merge-request-tabs.nav-links.no-top.no-bottom