summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWinnie Hellmann <winnie@gitlab.com>2019-05-03 23:13:03 +0200
committerWinnie Hellmann <winnie@gitlab.com>2019-05-07 23:32:53 +0200
commitbc753559860935687f5eb285c8def2a178a673d7 (patch)
tree721ad3fbd28100c47b17d703c60f512410d300f0
parent0625ccc652f97310b2444bb16ed8e20ee0642300 (diff)
downloadgitlab-ce-bc753559860935687f5eb285c8def2a178a673d7.tar.gz
Handle errors in successful notes reply
-rw-r--r--app/assets/javascripts/notes/stores/actions.js17
-rw-r--r--changelogs/unreleased/winh-notes-error-handling.yml5
-rw-r--r--locale/gitlab.pot3
3 files changed, 21 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) {
diff --git a/changelogs/unreleased/winh-notes-error-handling.yml b/changelogs/unreleased/winh-notes-error-handling.yml
new file mode 100644
index 00000000000..6f23dd459d4
--- /dev/null
+++ b/changelogs/unreleased/winh-notes-error-handling.yml
@@ -0,0 +1,5 @@
+---
+title: Handle errors in successful notes reply
+merge_request: 28082
+author:
+type: fixed
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 2907430bd51..1a35b1b5491 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -4196,6 +4196,9 @@ msgstr ""
msgid "Failed to remove user key."
msgstr ""
+msgid "Failed to save comment!"
+msgstr ""
+
msgid "Failed to save merge conflicts resolutions. Please try again!"
msgstr ""