diff options
-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 |