diff options
author | kushalpandya <kushal@gitlab.com> | 2017-05-05 14:40:05 +0530 |
---|---|---|
committer | kushalpandya <kushal@gitlab.com> | 2017-05-05 14:40:05 +0530 |
commit | 61fba28fd15545585043bf3c5b24a4125373dbfd (patch) | |
tree | 33ddf79ae6eda4ebcfd961929a3c78ed82b9bfbc | |
parent | d0d86e65cdbe26fa0e184225fa03bb63c20f2907 (diff) | |
download | gitlab-ce-27614-instant-comments.tar.gz |
Fix slash commands handling on note creation27614-instant-comments
-rw-r--r-- | app/assets/javascripts/notes.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 93b2254b95c..72709f68070 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -272,12 +272,8 @@ const normalizeNewlines = function(str) { return this.initRefresh(); }; - Notes.prototype.handleCreateChanges = function(noteEntity) { + Notes.prototype.handleSlashCommands = function(noteEntity) { var votesBlock; - if (typeof noteEntity === 'undefined') { - return; - } - if (noteEntity.commands_changes) { if ('merge' in noteEntity.commands_changes) { $.get(mrRefreshWidgetUrl); @@ -553,7 +549,6 @@ const normalizeNewlines = function(str) { */ Notes.prototype.addNote = function($form, note) { - this.handleCreateChanges(note); return this.renderNote(note); }; @@ -1307,6 +1302,10 @@ const normalizeNewlines = function(str) { this.reenableTargetFormSubmitButton(e); } + if (note.commands_changes) { + this.handleSlashCommands(note); + } + $form.trigger('ajax:success', [note]); }).fail(() => { // Submission failed, remove placeholder note and show Flash error message |