Commit 47b9390a authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch 'leipert-355095-fix-removal-of-notes' into 'master'

Fix deletion of deprecated notes

See merge request gitlab-org/gitlab!83089
parents fbc09c11 7f2fdfaa
......@@ -143,7 +143,7 @@ export default class Notes {
// resolve a discussion
this.$wrapperEl.on('click', '.js-comment-resolve-button', this.postComment);
// remove a note (in general)
this.$wrapperEl.on('click', '.js-note-delete', this.removeNote);
this.$wrapperEl.on('ajax:success', '.js-note-delete', this.removeNote);
// delete note attachment
this.$wrapperEl.on('click', '.js-note-attachment-delete', this.removeAttachment);
// update the file name when an attachment is selected
......@@ -188,7 +188,7 @@ export default class Notes {
cleanBinding() {
this.$wrapperEl.off('click', '.js-note-edit');
this.$wrapperEl.off('click', '.note-edit-cancel');
this.$wrapperEl.off('click', '.js-note-delete');
this.$wrapperEl.off('ajax:success', '.js-note-delete');
this.$wrapperEl.off('click', '.js-note-attachment-delete');
this.$wrapperEl.off('click', '.js-discussion-reply-button');
this.$wrapperEl.off('click', '.js-add-diff-note-button');
......@@ -827,6 +827,8 @@ export default class Notes {
*/
removeNote(e) {
const $note = $(e.currentTarget).closest('.note');
$note.one('ajax:complete', () => {
const noteElId = $note.attr('id');
$(`.note[id="${noteElId}"]`).each((i, el) => {
// A same note appears in the "Discussion" and in the "Changes" tab, we have
......@@ -871,6 +873,7 @@ export default class Notes {
Notes.checkMergeRequestStatus();
return this.updateNotesCount(-1);
});
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment