Merge pull request #6734 from coopdevs/disable-ui-mail-settings

Disable mail methods form so no one can edit
This commit is contained in:
Pau Pérez Fabregat
2021-02-04 17:57:32 +01:00
committed by GitHub
6 changed files with 28 additions and 13 deletions

View File

@@ -42,4 +42,15 @@
&.notice { background-color: rgba($color-notice, 0.8) }
&.success { background-color: rgba($color-success, 0.8) }
&.error { background-color: rgba($color-error, 0.8) }
}
}
.notice {
padding: 1rem;
margin-bottom: 1.5rem;
background-color: $spree-light-blue;
border-radius: $border-radius;
a {
font-weight: bold;
}
}

View File

@@ -16,3 +16,5 @@ $admin-table-border: $pale-blue;
$modal-close-button-color: #de6060;
$modal-close-button-hover-color: #bf4545;
$disabled-button: $light-grey;
$border-radius: 3px;

View File

@@ -10,7 +10,7 @@ module Spree
Spree::Config[name] = value
end
flash[:success] = Spree.t(:successfully_updated, resource: Spree.t(:mail_methods))
flash[:success] = Spree.t(:successfully_updated, resource: Spree.t(:mail_method_settings))
render :edit
end

View File

@@ -1,6 +1,8 @@
%div
.row
%fieldset.no-border-bottom
%div.notice
= t('spree.mail_settings_notice_html')
%legend{align: "center"}= t("spree.general")
.field
= label_tag :mails_from, t("spree.send_mails_as")
@@ -19,7 +21,7 @@
.field
= label_tag :intercept_email, t("spree.intercept_email_address")
%br/
= text_field_tag :intercept_email, Spree::Config[:intercept_email], maxlength: 256, class: 'fullwidth'
= text_field_tag :intercept_email, Spree::Config[:intercept_email], disabled: true, class: 'fullwidth'
%br/
%span.info
= t("spree.intercept_email_instructions")

View File

@@ -3101,6 +3101,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
choose_currency: "Choose Currency"
mail_method_settings: "Mail Method Settings"
mail_settings_notice_html: "Some of the following settings can't be edited and are listed here just for debugging purposes. Changes can be made by updating the instance's secrets and provisioning them using <a href='https://github.com/openfoodfoundation/ofn-install'>ofn-install</a>. Reach out to the OFN global team for further details."
general: "General"
enable_mail_delivery: "Enable Mail Delivery"
send_mails_as: "Send Mails As"

View File

@@ -5,19 +5,18 @@ require 'spec_helper'
describe "Mail Methods" do
include AuthenticationHelper
before(:each) do
login_as_admin_and_visit spree.edit_admin_general_settings_path
end
before { login_as_admin_and_visit spree.edit_admin_general_settings_path }
context "edit" do
before(:each) do
click_link "Mail Method Settings"
end
before { click_link "Mail Method Settings" }
it "should be able to edit mail method settings" do
fill_in "mail_bcc", with: "ofn@example.com"
click_button "Update"
expect(page).to have_content("successfully updated!")
it "only allows changing the mails_from setting" do
fill_in 'mails_from', with: 'ofn@example.com'
fill_in 'mail_bcc', with: 'bcc@example.com'
expect(page).to have_field('intercept_email', disabled: true)
click_button 'Update'
expect(page).to have_content('successfully updated!')
end
end
end