* feat: allow reply_to and email_from to be set for an SMTP config * feat: use these SMTP values in the mailers * spec: test the application_mailer * fix: validate with email, and not url * feat: mimic macs changes from https://github.com/forem/forem/pull/16216 to use in this PR * setup packs for admin * refactor: order the keys and add a const for the auth methods * feat: rename the header to a more user friendlly name * chore: move the section with Emails * feat: add a toggle that will show and hide the SMTP form under certain conditions * feat: add the javaScript to handle the toggles * feat: add a better description until we convert to a dropdown * feat: ensure that we have declared sendgrid_enabled * chore: add anote to the config controller * chore: remove references of the email addresses to keep brnach scoped * feat: tweak js * test: cypress workflow to update smtp settings * feat : update the smtp tests * remove comments * update test * chore: rename NOTE * feat: polisha dn test ForemInstance.only_sendgrid_enabled? * chore: remove specs * Update app/lib/constants/settings/smtp.rb Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> * Update spec/system/admin/config/admin_updates_smtp_settings_spec.rb Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> * Update spec/system/admin/config/admin_updates_smtp_settings_spec.rb Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> * Update spec/system/admin/config/admin_updates_smtp_settings_spec.rb Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> * Update app/javascript/packs/admin/config/smtp.js Co-authored-by: Nick Taylor <nick@iamdeveloper.com> * refactor js as per comments * refactor as per comments * Update cypress/integration/seededFlows/adminFlows/config/emailServerSettingsSection.spec.js Co-authored-by: Suzanne Aitchison <suzanne@forem.com> * refactor: update the Cypress tests Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> Co-authored-by: Nick Taylor <nick@iamdeveloper.com> Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
49 lines
2.4 KiB
Text
49 lines
2.4 KiB
Text
<%= javascript_packs_with_chunks_tag "admin/config/smtp", defer: true %>
|
|
|
|
<%= form_for(Settings::SMTP.new,
|
|
url: admin_settings_smtp_settings_path,
|
|
html: { data: {
|
|
action: "submit->config#updateConfigurationSettings",
|
|
testid: "emailServerSettings"
|
|
} }) do |f| %>
|
|
<div class="card mt-3" id="smtp-section">
|
|
<%= render partial: "admin/shared/card_header",
|
|
locals: { header: "Email Server Settings (SMTP)", state: "collapse", target: "smtpSettingsBodyContainer", expanded: false } %>
|
|
<div id="smtpSettingsBodyContainer" class="card-body collapse hide" aria-labelledby="smtpSettingsBodyContainer">
|
|
<fieldset class="grid gap-4">
|
|
|
|
<% if ForemInstance.sendgrid_enabled? %>
|
|
<div class="crayons-field crayons-field--checkbox mt-3">
|
|
<%= f.check_box :own_email_server,
|
|
checked: Settings::SMTP.provided_minimum_settings?,
|
|
class: "crayons-checkbox" %>
|
|
<%= f.label :own_email_server, class: "crayons-field__label" do %>
|
|
Use my own email server
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if ForemInstance.only_sendgrid_enabled? %>
|
|
<p class="mb-3">
|
|
As a Forem Cloud client, we provide an email server managed by the Forem team. All settings are managed by us and the from and reply email addresses are set as <%= ForemInstance.email %>. However, you can override this to use your own email server.
|
|
</p>
|
|
<% end %>
|
|
|
|
<div class="js-custom-smtp-section <%= "hidden" if ForemInstance.only_sendgrid_enabled? %>">
|
|
<% Settings::SMTP::OPTIONS.each do |config_key| %>
|
|
<div class="crayons-field mt-3">
|
|
<%= admin_config_label config_key, model: Settings::SMTP %>
|
|
<%= admin_config_description Constants::Settings::SMTP::DETAILS[config_key][:description] %>
|
|
<%= f.text_field config_key,
|
|
class: "crayons-textfield",
|
|
value: Settings::SMTP.public_send(config_key),
|
|
placeholder: Constants::Settings::SMTP::DETAILS[config_key][:placeholder],
|
|
"data-config-target": "smtpSetting#{config_key.to_s.camelize(:upper)}" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</fieldset>
|
|
<%= render "update_setting_button", f: f %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|