Commit 34a3f81f authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'cngo-fix-incorrect-usages-of-create-flash' into 'master'

Fix incorrect usages of createFlash

See merge request gitlab-org/gitlab!46883
parents 36b18fd1 b36ca1d8
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
}) })
.then(({ data }) => { .then(({ data }) => {
if (data.updateIssue.errors.length) { if (data.updateIssue.errors.length) {
createFlash(data.updateIssue.errors.join('. ')); createFlash({ message: data.updateIssue.errors.join('. ') });
return; return;
} }
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
// Dispatch event which updates open/close state, shared among the issue show page // Dispatch event which updates open/close state, shared among the issue show page
document.dispatchEvent(new CustomEvent('issuable_vue_app:change', payload)); document.dispatchEvent(new CustomEvent('issuable_vue_app:change', payload));
}) })
.catch(() => createFlash(__('Update failed. Please try again.'))) .catch(() => createFlash({ message: __('Update failed. Please try again.') }))
.finally(() => { .finally(() => {
this.isUpdatingState = false; this.isUpdatingState = false;
}); });
......
...@@ -7,11 +7,11 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -7,11 +7,11 @@ document.addEventListener('DOMContentLoaded', () => {
if (gon?.features?.ciLintVue) { if (gon?.features?.ciLintVue) {
import(/* webpackChunkName: 'ciLintIndex' */ '~/ci_lint/index') import(/* webpackChunkName: 'ciLintIndex' */ '~/ci_lint/index')
.then(module => module.default()) .then(module => module.default())
.catch(() => createFlash(ERROR)); .catch(() => createFlash({ message: ERROR }));
} else { } else {
import(/* webpackChunkName: 'ciLintEditor' */ '../ci_lint_editor') import(/* webpackChunkName: 'ciLintEditor' */ '../ci_lint_editor')
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
.then(module => new module.default()) .then(module => new module.default())
.catch(() => createFlash(ERROR)); .catch(() => createFlash({ message: ERROR }));
} }
}); });
...@@ -7,11 +7,11 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -7,11 +7,11 @@ document.addEventListener('DOMContentLoaded', () => {
if (gon?.features?.ciLintVue) { if (gon?.features?.ciLintVue) {
import(/* webpackChunkName: 'ciLintIndex' */ '~/ci_lint/index') import(/* webpackChunkName: 'ciLintIndex' */ '~/ci_lint/index')
.then(module => module.default()) .then(module => module.default())
.catch(() => createFlash(ERROR)); .catch(() => createFlash({ message: ERROR }));
} else { } else {
import(/* webpackChunkName: 'ciLintEditor' */ '../ci_lint_editor') import(/* webpackChunkName: 'ciLintEditor' */ '../ci_lint_editor')
// eslint-disable-next-line new-cap // eslint-disable-next-line new-cap
.then(module => new module.default()) .then(module => new module.default())
.catch(() => createFlash(ERROR)); .catch(() => createFlash({ message: ERROR }));
} }
}); });
...@@ -40,7 +40,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -40,7 +40,7 @@ document.addEventListener('DOMContentLoaded', () => {
new Diff(); new Diff();
}) })
.catch(() => { .catch(() => {
flash(__('An error occurred while retrieving diff files')); flash({ message: __('An error occurred while retrieving diff files') });
}); });
} else { } else {
new Diff(); new Diff();
......
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
.then(({ data }) => { .then(({ data }) => {
this.milestones = data; this.milestones = data;
}) })
.catch(() => createFlash(__('There was a problem fetching milestones.'))) .catch(() => createFlash({ message: __('There was a problem fetching milestones.') }))
.finally(() => { .finally(() => {
this.loading = false; this.loading = false;
}); });
......
...@@ -120,7 +120,9 @@ describe('MilestoneToken', () => { ...@@ -120,7 +120,9 @@ describe('MilestoneToken', () => {
wrapper.vm.fetchMilestoneBySearchTerm('foo'); wrapper.vm.fetchMilestoneBySearchTerm('foo');
return waitForPromises().then(() => { return waitForPromises().then(() => {
expect(createFlash).toHaveBeenCalledWith('There was a problem fetching milestones.'); expect(createFlash).toHaveBeenCalledWith({
message: 'There was a problem fetching milestones.',
});
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment