summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-03-19 14:37:48 +0000
committerFilipa Lacerda <filipa@gitlab.com>2018-03-19 14:37:48 +0000
commit051e5e99dfd38704d7fbaef291fc6e9b737723f8 (patch)
tree6df642641954f185343c9f70517ab53a966d0e1a
parentfbb83069deaad3db1239af66e6c9dc913f29f8f8 (diff)
parent6cfbb4459e35d88e88aa5f463a984f40db0e6bc9 (diff)
downloadgitlab-ce-051e5e99dfd38704d7fbaef291fc6e9b737723f8.tar.gz
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
-rw-r--r--app/assets/javascripts/notes.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 659ae575219..2afa4e4c1bf 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -105,6 +105,9 @@ export default class Notes {
this.basePollingInterval = 15000;
this.maxPollingSteps = 4;
+ this.$wrapperEl = hasVueMRDiscussionsCookie()
+ ? $(document).find('.diffs')
+ : $(document);
this.cleanBinding();
this.addBinding();
this.setPollingInterval();
@@ -138,10 +141,6 @@ export default class Notes {
}
addBinding() {
- this.$wrapperEl = hasVueMRDiscussionsCookie()
- ? $(document).find('.diffs')
- : $(document);
-
// Edit note link
this.$wrapperEl.on('click', '.js-note-edit', this.showEditForm.bind(this));
this.$wrapperEl.on('click', '.note-edit-cancel', this.cancelEdit);
@@ -226,14 +225,9 @@ export default class Notes {
$(window).on('hashchange', this.onHashChange);
this.boundGetContent = this.getContent.bind(this);
document.addEventListener('refreshLegacyNotes', this.boundGetContent);
- this.eventsBound = true;
}
cleanBinding() {
- if (!this.eventsBound) {
- return;
- }
-
this.$wrapperEl.off('click', '.js-note-edit');
this.$wrapperEl.off('click', '.note-edit-cancel');
this.$wrapperEl.off('click', '.js-note-delete');