diff options
author | Kushal Pandya <kushalspandya@gmail.com> | 2017-04-20 11:11:51 +0000 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-04-20 11:11:51 +0000 |
commit | d586b6cced34d663f018203e99aecbb9c6ac3158 (patch) | |
tree | dd01b08da4233d1b27762021fa9919a2708d12f9 /app/assets/javascripts/diff_notes/components/resolve_btn.js | |
parent | f96e1bf12432b0f4eff4a900caa46a0c4790123f (diff) | |
download | gitlab-ce-d586b6cced34d663f018203e99aecbb9c6ac3158.tar.gz |
Add ES lint support to identify poorly written Promises
Diffstat (limited to 'app/assets/javascripts/diff_notes/components/resolve_btn.js')
-rw-r--r-- | app/assets/javascripts/diff_notes/components/resolve_btn.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/assets/javascripts/diff_notes/components/resolve_btn.js b/app/assets/javascripts/diff_notes/components/resolve_btn.js index 8fafd13c6c2..92f6fd654b3 100644 --- a/app/assets/javascripts/diff_notes/components/resolve_btn.js +++ b/app/assets/javascripts/diff_notes/components/resolve_btn.js @@ -64,6 +64,8 @@ const ResolveBtn = Vue.extend({ }); }, resolve: function () { + const errorFlashMsg = 'An error occurred when trying to resolve a comment. Please try again.'; + if (!this.canResolve) return; let promise; @@ -87,10 +89,12 @@ const ResolveBtn = Vue.extend({ CommentsStore.update(this.discussionId, this.noteId, !this.isResolved, resolved_by); this.discussion.updateHeadline(data); } else { - new Flash('An error occurred when trying to resolve a comment. Please try again.', 'alert'); + new Flash(errorFlashMsg); } this.updateTooltip(); + }).catch(() => { + new Flash(errorFlashMsg); }); } }, |