From 37942cb8bb74e561613b38dfef042b3a5b2da9f7 Mon Sep 17 00:00:00 2001 From: Isaac Janzen <50783505+janzenisaac@users.noreply.github.com> Date: Thu, 20 Jul 2023 16:31:20 -0500 Subject: [PATCH] DEV: Convert `admin-incoming-email` modal to component-based API (#22701) - Convert `admin-incoming-email` modal to component-based API - Testing that the modal was working in local development was extremely challenging due to the need for `rejected` and `bounced` emails. Something that is not easy to stub in a local dev environment. To make this process more smooth for future developers I have added a new rake task: ``` desc "Creates sample email logs" task "email_logs:populate" => ["db:load_config"] do |_, args| DiscourseDev::EmailLog.populate! end ``` That will generate fully functional email logs in development to be toyed with. Screenshot 2023-07-20 at 3 27 04 PM --- .../addon/components/modal/incoming-email.hbs | 54 +++++++++++++ .../modals/admin-incoming-email.js | 28 ------- .../admin/addon/routes/admin-email-bounced.js | 21 ++++- .../addon/routes/admin-email-rejected.js | 11 ++- .../templates/modal/admin-incoming-email.hbs | 50 ------------ .../discourse/app/services/modal.js | 1 - config/dev_defaults.yml | 2 + lib/discourse_dev/email_log.rb | 77 +++++++++++++++++++ lib/tasks/populate.rake | 5 ++ 9 files changed, 162 insertions(+), 87 deletions(-) create mode 100644 app/assets/javascripts/admin/addon/components/modal/incoming-email.hbs delete mode 100644 app/assets/javascripts/admin/addon/controllers/modals/admin-incoming-email.js delete mode 100644 app/assets/javascripts/admin/addon/templates/modal/admin-incoming-email.hbs create mode 100644 lib/discourse_dev/email_log.rb diff --git a/app/assets/javascripts/admin/addon/components/modal/incoming-email.hbs b/app/assets/javascripts/admin/addon/components/modal/incoming-email.hbs new file mode 100644 index 00000000000..e1beb0f6664 --- /dev/null +++ b/app/assets/javascripts/admin/addon/components/modal/incoming-email.hbs @@ -0,0 +1,54 @@ + + <:body> +
+ +
+

{{@model.error}}

+ {{#if @model.error_description}} +

{{@model.error_description}}

+ {{/if}} +
+
+ +
+ +
+ +
+