diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-19 17:16:28 +0300 |
commit | e4384360a16dd9a19d4d2d25d0ef1f2b862ed2a6 (patch) | |
tree | 2fcdfa7dcdb9db8f5208b2562f4b4e803d671243 /app/assets/javascripts/deprecated_notes.js | |
parent | ffda4e7bcac36987f936b4ba515995a6698698f0 (diff) |
Add latest changes from gitlab-org/gitlab@16-2-stable-eev16.2.0-rc42
Diffstat (limited to 'app/assets/javascripts/deprecated_notes.js')
-rw-r--r-- | app/assets/javascripts/deprecated_notes.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/assets/javascripts/deprecated_notes.js b/app/assets/javascripts/deprecated_notes.js index 08177cd0eac..6dbf12054cf 100644 --- a/app/assets/javascripts/deprecated_notes.js +++ b/app/assets/javascripts/deprecated_notes.js @@ -515,9 +515,8 @@ export default class Notes { } if (discussionContainer.length === 0) { if (noteEntity.diff_discussion_html) { - const discussionElement = document.createElement('table'); + let discussionElement = document.createElement('table'); let internalNote; - let discussionDOM; if (!noteEntity.on_image) { /* @@ -536,16 +535,15 @@ export default class Notes { Curiously, DOMPurify **ADDS** a totally novel <tbody>, so we're actually inserting a completely as-yet-unseen <tbody> element here. */ - discussionDOM = internalNote.querySelector('table').firstChild; + discussionElement = internalNote.querySelector('table').querySelector('.notes_holder'); } else { // Image comments don't need <table> manipulation, they're already <div>s internalNote = sanitize(noteEntity.diff_discussion_html, { RETURN_DOM: true, }); - discussionDOM = internalNote.firstChild; + discussionElement.insertAdjacentElement('afterbegin', internalNote.firstElementChild); } - discussionElement.insertAdjacentElement('afterbegin', discussionDOM); renderGFM(discussionElement); const $discussion = $(discussionElement).unwrap(); @@ -1464,7 +1462,11 @@ export default class Notes { $note.addClass('fade-in-full'); renderGFM(Notes.getNodeToRender($note)); - $notesList.append($note); + if ($notesList.find('.discussion-reply-holder').length) { + $notesList.children('.timeline-entry').last().after($note); + } else { + $notesList.append($note); + } return $note; } |