diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-05-03 23:13:03 +0200 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2019-05-07 23:32:53 +0200 |
commit | bc753559860935687f5eb285c8def2a178a673d7 (patch) | |
tree | 721ad3fbd28100c47b17d703c60f512410d300f0 /app/assets/javascripts | |
parent | 0625ccc652f97310b2444bb16ed8e20ee0642300 (diff) | |
download | gitlab-ce-bc753559860935687f5eb285c8def2a178a673d7.tar.gz |
Handle errors in successful notes reply
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/notes/stores/actions.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index bac124be34c..63658d49a05 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -268,11 +268,20 @@ export const saveNote = ({ commit, dispatch }, noteData) => { const { errors } = res; const commandsChanges = res.commands_changes; - if (hasQuickActions && errors && Object.keys(errors).length) { - eTagPoll.makeRequest(); + if (errors && Object.keys(errors).length) { + /* + The following reply means that quick actions have been successfully applied: - $('.js-gfm-input').trigger('clear-commands-cache.atwho'); - Flash(__('Commands applied'), 'notice', noteData.flashContainer); + {"commands_changes":{},"valid":false,"errors":{"commands_only":["Commands applied"]}} + */ + if (hasQuickActions) { + eTagPoll.makeRequest(); + + $('.js-gfm-input').trigger('clear-commands-cache.atwho'); + Flash(__('Commands applied'), 'notice', noteData.flashContainer); + } else { + throw new Error(__('Failed to save comment!')); + } } if (commandsChanges) { |