discourse/app/assets/javascripts/admin/addon/components/modal/incoming-email.hbs
Isaac Janzen 37942cb8bb
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.

<img width="787" alt="Screenshot 2023-07-20 at 3 27 04 PM" src="https://github.com/discourse/discourse/assets/50783505/47b3fe34-cd7e-49a5-8fe6-768c0fbd1aa2">
2023-07-20 16:31:20 -05:00

54 lines
1.4 KiB
Handlebars

<DModal
class="admin-incoming-email-modal"
@title={{i18n "admin.email.incoming_emails.modal.title"}}
@closeModal={{@closeModal}}
@bodyClass="incoming-emails"
>
<:body>
<div class="control-group">
<label>{{i18n "admin.email.incoming_emails.modal.error"}}</label>
<div class="controls">
<p>{{@model.error}}</p>
{{#if @model.error_description}}
<p class="error-description">{{@model.error_description}}</p>
{{/if}}
</div>
</div>
<hr />
<div class="control-group">
<label>{{i18n "admin.email.incoming_emails.modal.headers"}}</label>
<div class="controls">
<Textarea @value={{@model.headers}} wrap="off" />
</div>
</div>
<div class="control-group">
<label>{{i18n "admin.email.incoming_emails.modal.subject"}}</label>
<div class="controls">
{{@model.subject}}
</div>
</div>
<div class="control-group">
<label>{{i18n "admin.email.incoming_emails.modal.body"}}</label>
<div class="controls">
<Textarea @value={{@model.body}} />
</div>
</div>
{{#if @model.rejection_message}}
<hr />
<div class="control-group">
<label>{{i18n
"admin.email.incoming_emails.modal.rejection_message"
}}</label>
<div class="controls">
<Textarea @value={{@model.rejection_message}} />
</div>
</div>
{{/if}}
</:body>
</DModal>