Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Remove Store#contact_email

Damian Legawiecac1830677c81
diff --git a/api/app/serializers/spree/v2/storefront/store_serializer.rb b/api/app/serializers/spree/v2/storefront/store_serializer.rb
index 735922f5f9..e50192a7d3 100644
--- a/api/app/serializers/spree/v2/storefront/store_serializer.rb
+++ b/api/app/serializers/spree/v2/storefront/store_serializer.rb
@@ -6,7 +6,7 @@ module Spree
attributes :name, :url, :meta_description, :meta_keywords, :seo_title, :default_currency, :default, :supported_currencies, :facebook,
:twitter, :instagram, :default_locale, :customer_support_email, :default_country_id, :description,
- :address, :contact_phone, :contact_email
+ :address, :contact_phone
has_one :default_country, serializer: :country, record_type: :country, id_method_name: :default_country_id
end
diff --git a/api/spec/controllers/spree/api/v1/stores_controller_spec.rb b/api/spec/controllers/spree/api/v1/stores_controller_spec.rb
index 4f3cbb7ec6..9266089127 100644
--- a/api/spec/controllers/spree/api/v1/stores_controller_spec.rb
+++ b/api/spec/controllers/spree/api/v1/stores_controller_spec.rb
@@ -91,7 +91,6 @@ module Spree
name: 'Hack0rz',
url: 'spree123.example.com',
mail_from_address: '[email protected]',
- customer_support_email: '[email protected]',
default_currency: 'USD',
supported_currencies: 'USD'
}
diff --git a/api/spec/requests/spree/api/v2/storefront/stores_controller_spec.rb b/api/spec/requests/spree/api/v2/storefront/stores_spec.rb
similarity index 95%
rename from api/spec/requests/spree/api/v2/storefront/stores_controller_spec.rb
rename to api/spec/requests/spree/api/v2/storefront/stores_spec.rb
index 5ae72e4353..0aaa26a0df 100644
--- a/api/spec/requests/spree/api/v2/storefront/stores_controller_spec.rb
+++ b/api/spec/requests/spree/api/v2/storefront/stores_spec.rb
@@ -23,7 +23,6 @@ describe 'Storefront API v2 Stores spec', type: :request do
expect(json_response['data']).to have_attribute(:description).with_value(store.description)
expect(json_response['data']).to have_attribute(:address).with_value(store.address)
expect(json_response['data']).to have_attribute(:contact_phone).with_value(store.contact_phone)
- expect(json_response['data']).to have_attribute(:contact_email).with_value(store.contact_email)
expect(json_response['data']).to have_relationship(:default_country)
expect(json_response['data']).to have_relationship(:default_country).with_data('id' => store.default_country_id.to_s, 'type' => 'country')
diff --git a/backend/app/views/spree/admin/stores/_form.html.erb b/backend/app/views/spree/admin/stores/_form.html.erb
index 608cec9ce6..8fb8788bd8 100644
--- a/backend/app/views/spree/admin/stores/_form.html.erb
+++ b/backend/app/views/spree/admin/stores/_form.html.erb
@@ -212,11 +212,6 @@
<%= f.text_area :address, class: 'form-control' %>
<%= f.error_message_on :address %>
<% end %>
- <%= f.field_container :contact_email, class: ['form-group'] do %>
- <%= f.label :contact_email, Spree.t(:contact_email) %>
- <%= f.text_field :contact_email, class: 'form-control' %>
- <%= f.error_message_on :contact_email %>
- <% end %>
<%= f.field_container :contact_phone, class: ['form-group'] do %>
<%= f.label :contact_phone, Spree.t(:contact_phone) %>
<%= f.text_field :contact_phone, class: 'form-control' %>
diff --git a/backend/spec/features/admin/store_spec.rb b/backend/spec/features/admin/store_spec.rb
index 8e8f0c9d9e..359e6bdacd 100644
--- a/backend/spec/features/admin/store_spec.rb
+++ b/backend/spec/features/admin/store_spec.rb
@@ -25,7 +25,6 @@ describe 'Stores', type: :feature, js: true do
expect(page).to have_field(id: 'store_description')
expect(page).to have_field(id: 'store_address')
expect(page).to have_field(id: 'store_contact_phone')
- expect(page).to have_field(id: 'store_contact_email')
end
it 'has seo fields' do
@@ -54,7 +53,7 @@ describe 'Stores', type: :feature, js: true do
fill_in 'Description', with: 'New store description'
fill_in 'Address', with: 'New store address 123, City 123'
fill_in 'Contact phone', with: '123123123'
- fill_in 'Contact email', with: '[email protected]'
+ fill_in 'Customer Support Email', with: '[email protected]'
fill_in 'SEO Title', with: 'Spree Store meta title'
fill_in 'Meta Description', with: 'Spree Store meta description'
fill_in 'Meta Keywords', with: 'Spree, Store'
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index 6f265a3080..3edce8a407 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -30,6 +30,8 @@ module Spree
after_commit :clear_cache
+ alias_attribute :contact_email, :customer_support_email
+
def self.current(domain = nil)
current_store = domain ? Store.by_url(domain).first : nil
current_store || Store.default
diff --git a/core/config/locales/en.yml b/core/config/locales/en.yml
index 02100d4c17..fcb199e12a 100644
--- a/core/config/locales/en.yml
+++ b/core/config/locales/en.yml
@@ -696,7 +696,6 @@ en:
confirm: Confirm
confirm_delete: Confirm Deletion
confirm_password: Password Confirmation
- contact_email: Contact email
contact_phone: Contact phone
contact_us: Contact us
continue: Continue
diff --git a/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb b/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb
new file mode 100644
index 0000000000..652e66a774
--- /dev/null
+++ b/core/db/migrate/20210112193440_remove_contact_email_from_spree_stores.rb
@@ -0,0 +1,5 @@
+class RemoveContactEmailFromSpreeStores < ActiveRecord::Migration[6.1]
+ def change
+ remove_column :spree_stores, :contact_email
+ end
+end
diff --git a/core/lib/spree/permitted_attributes.rb b/core/lib/spree/permitted_attributes.rb
index 28e5bb4e75..c2f3864243 100644
--- a/core/lib/spree/permitted_attributes.rb
+++ b/core/lib/spree/permitted_attributes.rb
@@ -99,7 +99,7 @@ module Spree
@@store_attributes = [:name, :url, :seo_title, :code, :meta_keywords, :logo,
:meta_description, :default_currency, :mail_from_address,
:customer_support_email, :facebook, :twitter, :instagram,
- :description, :address, :contact_email, :contact_phone,
+ :description, :address, :contact_phone,
:default_locale, :default_country_id, :supported_currencies,
:new_order_notifications_email, :mailer_logo, :checkout_zone_id, :seo_robots]
diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb
index 80ff7f8c0c..00f28b11a0 100644
--- a/core/spec/models/spree/store_spec.rb
+++ b/core/spec/models/spree/store_spec.rb
@@ -80,7 +80,6 @@ describe Spree::Store, type: :model do
expect(store.description).to eq('Some description')
expect(store.address).to eq('Address street 123, City 17')
expect(store.contact_phone).to eq('123123123')
- expect(store.contact_email).to eq('[email protected]')
end
end
diff --git a/frontend/app/views/spree/shared/_footer.html.erb b/frontend/app/views/spree/shared/_footer.html.erb
index f8189f38b3..6d33cceda3 100644
--- a/frontend/app/views/spree/shared/_footer.html.erb
+++ b/frontend/app/views/spree/shared/_footer.html.erb
@@ -41,8 +41,8 @@
<% if current_store.contact_phone&.present? %>
<div><%= Spree.t(:call_us_now) %><%= current_store.contact_phone %></div>
<% end %>
- <% if current_store.contact_email&.present? %>
- <div><%= Spree.t(:email) %>: <%= current_store.contact_email %></div>
+ <% if current_store.customer_support_email&.present? %>
+ <div><%= Spree.t(:email) %>: <%= current_store.customer_support_email %></div>
<% end %>
</div>
</div>
diff --git a/frontend/spec/features/store_spec.rb b/frontend/spec/features/store_spec.rb
index cfb90d3c0f..a791d0c334 100644
--- a/frontend/spec/features/store_spec.rb
+++ b/frontend/spec/features/store_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'Store', type: :feature, js: true do
context 'stores footer info is shown in footer' do
before do
- create(:store, default: true, description: 'This is store description', address: 'Address street 123, City 123', contact_phone: '123123123', contact_email: '[email protected]')
+ create(:store, default: true, description: 'This is store description', address: 'Address street 123, City 123', contact_phone: '123123123', customer_support_email: '[email protected]')
visit spree.root_path
end