Commit 051e5e99 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch...

Merge branch '43928-merge-request-comment-gets-cleared-once-the-previous-comment-is-submitted' into 'master'

Resolve "Notes karma specs failing"

Closes #44002

See merge request gitlab-org/gitlab-ce!17627
parents fbb83069 6cfbb445
...@@ -105,6 +105,9 @@ export default class Notes { ...@@ -105,6 +105,9 @@ export default class Notes {
this.basePollingInterval = 15000; this.basePollingInterval = 15000;
this.maxPollingSteps = 4; this.maxPollingSteps = 4;
this.$wrapperEl = hasVueMRDiscussionsCookie()
? $(document).find('.diffs')
: $(document);
this.cleanBinding(); this.cleanBinding();
this.addBinding(); this.addBinding();
this.setPollingInterval(); this.setPollingInterval();
...@@ -138,10 +141,6 @@ export default class Notes { ...@@ -138,10 +141,6 @@ export default class Notes {
} }
addBinding() { addBinding() {
this.$wrapperEl = hasVueMRDiscussionsCookie()
? $(document).find('.diffs')
: $(document);
// Edit note link // Edit note link
this.$wrapperEl.on('click', '.js-note-edit', this.showEditForm.bind(this)); this.$wrapperEl.on('click', '.js-note-edit', this.showEditForm.bind(this));
this.$wrapperEl.on('click', '.note-edit-cancel', this.cancelEdit); this.$wrapperEl.on('click', '.note-edit-cancel', this.cancelEdit);
...@@ -226,14 +225,9 @@ export default class Notes { ...@@ -226,14 +225,9 @@ export default class Notes {
$(window).on('hashchange', this.onHashChange); $(window).on('hashchange', this.onHashChange);
this.boundGetContent = this.getContent.bind(this); this.boundGetContent = this.getContent.bind(this);
document.addEventListener('refreshLegacyNotes', this.boundGetContent); document.addEventListener('refreshLegacyNotes', this.boundGetContent);
this.eventsBound = true;
} }
cleanBinding() { cleanBinding() {
if (!this.eventsBound) {
return;
}
this.$wrapperEl.off('click', '.js-note-edit'); this.$wrapperEl.off('click', '.js-note-edit');
this.$wrapperEl.off('click', '.note-edit-cancel'); this.$wrapperEl.off('click', '.note-edit-cancel');
this.$wrapperEl.off('click', '.js-note-delete'); this.$wrapperEl.off('click', '.js-note-delete');
......
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