summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-03-13 16:13:12 -0600
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-05 17:44:14 +0100
commit9c30b0e918ca035d8555de5e3393247f6d00ed16 (patch)
tree7aeea9695748036cf465952711184f2469427fab /app
parent336016fa858dfa48b9f9e9b5b2d9c3a9000fffe5 (diff)
downloadgitlab-ce-9c30b0e918ca035d8555de5e3393247f6d00ed16.tar.gz
Fix some specs
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/notes.js4
-rw-r--r--app/controllers/projects/notes_controller.rb2
-rw-r--r--app/helpers/notes_helper.rb4
-rw-r--r--app/views/projects/notes/_notes.html.haml2
4 files changed, 6 insertions, 6 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 71c03c89314..226029ba8f3 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -192,7 +192,7 @@ require('./task_list');
};
Notes.prototype.refresh = function() {
- if (!document.hidden && document.URL.indexOf(this.noteable_url) === 0) {
+ if (!document.hidden) {
return this.getContent();
}
};
@@ -371,7 +371,7 @@ require('./task_list');
discussionContainer.append(note_html);
}
- if (typeof gl.diffNotesCompileComponents !== 'undefined' && note.discussion_id) {
+ if (typeof gl.diffNotesCompileComponents !== 'undefined' && note.discussion_resolvable) {
gl.diffNotesCompileComponents();
this.renderDiscussionAvatar(diffAvatarContainer, note);
}
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb
index f80313bbee0..186098c67b7 100644
--- a/app/controllers/projects/notes_controller.rb
+++ b/app/controllers/projects/notes_controller.rb
@@ -169,6 +169,8 @@ class Projects::NotesController < Projects::ApplicationController
discussion = note.to_discussion(noteable)
unless discussion.render_as_individual_notes?
attrs.merge!(
+ discussion_resolvable: discussion.resolvable?,
+
diff_discussion_html: diff_discussion_html(discussion),
discussion_html: discussion_html(discussion),
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 01ecac983cf..e2fa9905e86 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -54,17 +54,15 @@ module NotesHelper
if use_legacy_diff_note
new_note = LegacyDiffNote.new(@new_diff_note_attrs.merge(line_code: line_code))
- discussion_id = new_note.discussion_id
else
new_note = DiffNote.new(@new_diff_note_attrs.merge(position: position))
- discussion_id = new_note.discussion_id
data[:position] = position.to_json
end
data.merge(
note_type: new_note.type,
- discussion_id: discussion_id
+ discussion_id: new_note.discussion_class.discussion_id(new_note)
)
end
diff --git a/app/views/projects/notes/_notes.html.haml b/app/views/projects/notes/_notes.html.haml
index 50809068453..d619f7ac262 100644
--- a/app/views/projects/notes/_notes.html.haml
+++ b/app/views/projects/notes/_notes.html.haml
@@ -1,4 +1,4 @@
-- if @discussions.present?
+- if defined?(@discussions)
- @discussions.each do |discussion|
- if discussion.render_as_individual_notes?
= render partial: "projects/notes/note", collection: discussion.notes, as: :note