From 075c0f78679b9fab285f456767729d3efe2d472f Mon Sep 17 00:00:00 2001 From: Jared Galanis Date: Fri, 16 Jun 2023 11:32:42 -0400 Subject: [PATCH] fix: fix flash messages (#1190) --- app/components/workflow-review/index.hbs | 26 +++++++++++------------- app/controllers/submissions/new.js | 19 +++++++++++------ 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/app/components/workflow-review/index.hbs b/app/components/workflow-review/index.hbs index 18c5cebb..fae80055 100644 --- a/app/components/workflow-review/index.hbs +++ b/app/components/workflow-review/index.hbs @@ -1,19 +1,17 @@ {{! template-lint-disable no-action no-inline-styles no-unknown-arguments-for-builtin-components require-button-type require-input-label }}
- {{#if this.isTest}} - {{#each this.flashMessages.queue as |flash|}} -
- -
- {{flash.message}} - - x - -
-
-
- {{/each}} - {{/if}} + {{#each this.flashMessages.queue as |flash|}} +
+ +
+ {{flash.message}} + + x + +
+
+
+ {{/each}}
diff --git a/app/controllers/submissions/new.js b/app/controllers/submissions/new.js index 75077ef0..fc689a16 100644 --- a/app/controllers/submissions/new.js +++ b/app/controllers/submissions/new.js @@ -101,15 +101,22 @@ export default class SubmissionsNew extends Controller { await get(this, 'submissionHandler.submit') .perform(sub, pub, files, comment) + .then(() => { + set(this, 'uploading', false); + set(this, 'comment', ''); + set(this, 'workflow.filesTemp', A()); + this.transitionToRoute('thanks', { queryParams: { submission: get(sub, 'id') } }); + }) .catch((error) => { this.set('uploading', false); - this.flashMessages.error(`Submission failed: ${error.message}`); - }); - set(this, 'uploading', false); - set(this, 'comment', ''); - set(this, 'workflow.filesTemp', A()); - this.transitionToRoute('thanks', { queryParams: { submission: get(sub, 'id') } }); + this.flashMessages.danger(`Submission failed: ${error.message}`); + + const elements = document.querySelectorAll('.block-user-input'); + elements.forEach((el) => { + el.style.display = 'none'; + }); + }); } }