summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <clement@gitlab.com>2017-05-25 18:22:14 +0000
committerClement Ho <clement@gitlab.com>2017-05-25 18:22:14 +0000
commitacb026f9a95b1328cfcf9fdf91e8184b608a9cd7 (patch)
tree14f02d12a05a3558c5452481d86b72df2516ac1d
parent0a6ee7ceca46fa92afc3c07cb62b5e788ce2478e (diff)
downloadgitlab-ce-acb026f9a95b1328cfcf9fdf91e8184b608a9cd7.tar.gz
Revert "Merge branch '32908-edit-comment' into 'master'"
This reverts merge request !2105
-rw-r--r--app/assets/javascripts/notes.js4
-rw-r--r--changelogs/unreleased/32908-edit-comment.yml4
-rw-r--r--spec/javascripts/notes_spec.js39
3 files changed, 2 insertions, 45 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 702915c516f..b0b1cfd6c8a 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -1398,7 +1398,7 @@ const normalizeNewlines = function(str) {
const cachedNoteBodyText = $noteBodyText.html();
// Show updated comment content temporarily
- $noteBodyText.html(_.escape(formContent));
+ $noteBodyText.html(formContent);
$editingNote.removeClass('is-editing fade-in-full').addClass('being-posted fade-in-half');
$editingNote.find('.note-headline-meta a').html('<i class="fa fa-spinner fa-spin" aria-label="Comment is being updated" aria-hidden="true"></i>');
@@ -1411,7 +1411,7 @@ const normalizeNewlines = function(str) {
})
.fail(() => {
// Submission failed, revert back to original note
- $noteBodyText.html(_.escape(cachedNoteBodyText));
+ $noteBodyText.html(cachedNoteBodyText);
$editingNote.removeClass('being-posted fade-in');
$editingNote.find('.fa.fa-spinner').remove();
diff --git a/changelogs/unreleased/32908-edit-comment.yml b/changelogs/unreleased/32908-edit-comment.yml
deleted file mode 100644
index 5237dceed11..00000000000
--- a/changelogs/unreleased/32908-edit-comment.yml
+++ /dev/null
@@ -1,4 +0,0 @@
----
-title: Escapes html content before appending it to the DOM
-merge_request:
-author:
diff --git a/spec/javascripts/notes_spec.js b/spec/javascripts/notes_spec.js
index ccd703b5b4b..025f08ee332 100644
--- a/spec/javascripts/notes_spec.js
+++ b/spec/javascripts/notes_spec.js
@@ -443,45 +443,6 @@ import '~/notes';
});
});
- describe('update comment with script tags', () => {
- const sampleComment = '<script></script>';
- const updatedComment = '<script></script>';
- const note = {
- id: 1234,
- html: `<li class="note note-row-1234 timeline-entry" id="note_1234">
- <div class="note-text">${sampleComment}</div>
- </li>`,
- note: sampleComment,
- valid: true
- };
- let $form;
- let $notesContainer;
-
- beforeEach(() => {
- this.notes = new Notes('', []);
- window.gon.current_username = 'root';
- window.gon.current_user_fullname = 'Administrator';
- $form = $('form.js-main-target-form');
- $notesContainer = $('ul.main-notes-list');
- $form.find('textarea.js-note-text').html(sampleComment);
- });
-
- it('should not render a script tag', () => {
- const deferred = $.Deferred();
- spyOn($, 'ajax').and.returnValue(deferred.promise());
- $('.js-comment-button').click();
-
- deferred.resolve(note);
- const $noteEl = $notesContainer.find(`#note_${note.id}`);
- $noteEl.find('.js-note-edit').click();
- $noteEl.find('textarea.js-note-text').html(updatedComment);
- $noteEl.find('.js-comment-save-button').click();
-
- const $updatedNoteEl = $notesContainer.find(`#note_${note.id}`).find('.js-task-list-container');
- expect($updatedNoteEl.find('.note-text').text().trim()).toEqual('');
- });
- });
-
describe('getFormData', () => {
it('should return form metadata object from form reference', () => {
this.notes = new Notes('', []);