Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-05-19 19:30:42 +0300
committerFilipa Lacerda <filipa@gitlab.com>2017-05-19 19:30:42 +0300
commitc19d58de67ecf0fcf224ad72d1756e2e9b8fe83c (patch)
tree6ae169bf8d25a7e091260a40045d32beec9931dc /app
parent6ad2a9c2e996bab4001f97a79e9ec3c7ce09be3f (diff)
parent682cfbb4dc328a8ffa597ddbb337673ed5dc844f (diff)
Merge branch '32551-fix-system-note-comparison-and-standardize-note-setup' into 'master'
Fix system note comparison and standardize note setup Closes #32551 See merge request !11532
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/notes.js22
-rw-r--r--app/views/shared/notes/_note.html.haml2
2 files changed, 11 insertions, 13 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 62a46733cc4..79293fe2d4a 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -287,6 +287,13 @@ const normalizeNewlines = function(str) {
}
};
+ Notes.prototype.setupNewNote = function($note) {
+ // Update datetime format on the recent note
+ gl.utils.localTimeAgo($note.find('.js-timeago'), false);
+ this.collapseLongCommitList();
+ this.taskList.init();
+ };
+
/*
Render note in main comments area.
@@ -312,10 +319,7 @@ const normalizeNewlines = function(str) {
const $newNote = Notes.animateAppendNote(noteEntity.html, $notesList);
- // Update datetime format on the recent note
- gl.utils.localTimeAgo($newNote.find('.js-timeago'), false);
- this.collapseLongCommitList();
- this.taskList.init();
+ this.setupNewNote($newNote);
this.refresh();
return this.updateNotesCount(1);
}
@@ -341,9 +345,7 @@ const normalizeNewlines = function(str) {
}
else {
const $updatedNote = Notes.animateUpdateNote(noteEntity.html, $note);
-
- // Update datetime format on the recent note
- gl.utils.localTimeAgo($updatedNote.find('.js-timeago'), false);
+ this.setupNewNote($updatedNote);
}
}
};
@@ -665,10 +667,8 @@ const normalizeNewlines = function(str) {
if (this.updatedNotesTrackingMap[noteId]) {
const $newNote = $(this.updatedNotesTrackingMap[noteId].html);
$note.replaceWith($newNote);
+ this.setupNewNote($newNote);
this.updatedNotesTrackingMap[noteId] = null;
-
- // Update datetime format on the recent note
- gl.utils.localTimeAgo($newNote.find('.js-timeago'), false);
}
else {
$note.find('.js-finish-edit-warning').hide();
@@ -1144,7 +1144,7 @@ const normalizeNewlines = function(str) {
// There can be CRLF vs LF mismatches if we don't sanitize and compare the same way
const sanitizedNoteEntityText = normalizeNewlines(noteEntity.note.trim());
const currentNoteText = normalizeNewlines(
- $note.find('.original-note-content').text().trim()
+ $note.find('.original-note-content').first().text().trim()
);
return sanitizedNoteEntityText !== currentNoteText;
};
diff --git a/app/views/shared/notes/_note.html.haml b/app/views/shared/notes/_note.html.haml
index 53d0e837aa0..a7bf610b9c7 100644
--- a/app/views/shared/notes/_note.html.haml
+++ b/app/views/shared/notes/_note.html.haml
@@ -29,8 +29,6 @@
- if note.system
%span.system-note-message
= note.redacted_note_html
- .original-note-content.hidden
- = note.note
%a{ href: "##{dom_id(note)}" }
= time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
- unless note.system?