From 70aff98581196c1a8d3ae8eeaeb9e5303621cc31 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 15 Mar 2023 14:17:17 +1100 Subject: [PATCH 1/2] Remove unused product meta description from UI --- app/models/spree/product.rb | 2 ++ app/models/spree/variant.rb | 2 +- app/services/permitted_attributes/product.rb | 2 +- app/views/spree/admin/products/_seo_form.html.haml | 5 ----- config/locales/en.yml | 1 - .../unit/admin/bulk_product_update_spec.js.coffee | 2 -- 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/models/spree/product.rb b/app/models/spree/product.rb index 4e603ab48c..9d4bd99f0a 100755 --- a/app/models/spree/product.rb +++ b/app/models/spree/product.rb @@ -27,6 +27,8 @@ module Spree include PermalinkGenerator include ProductStock + self.ignored_columns = [:meta_description] + acts_as_paranoid searchable_attributes :supplier_id, :primary_taxon_id, :meta_keywords diff --git a/app/models/spree/variant.rb b/app/models/spree/variant.rb index 022f90c54b..263947905a 100644 --- a/app/models/spree/variant.rb +++ b/app/models/spree/variant.rb @@ -20,7 +20,7 @@ module Spree belongs_to :product, -> { with_deleted }, touch: true, class_name: 'Spree::Product' delegate_belongs_to :product, :name, :description, :permalink, :available_on, - :tax_category_id, :shipping_category_id, :meta_description, + :tax_category_id, :shipping_category_id, :meta_keywords, :tax_category, :shipping_category has_many :inventory_units, inverse_of: :variant diff --git a/app/services/permitted_attributes/product.rb b/app/services/permitted_attributes/product.rb index 0f5ba4ea5b..555a764a40 100644 --- a/app/services/permitted_attributes/product.rb +++ b/app/services/permitted_attributes/product.rb @@ -8,7 +8,7 @@ module PermittedAttributes :variant_unit, :variant_unit_scale, :unit_value, :unit_description, :variant_unit_name, :display_as, :sku, :available_on, :group_buy, :group_buy_unit_size, :taxon_ids, :primary_taxon_id, :tax_category_id, :shipping_category_id, - :meta_keywords, :meta_description, :notes, :inherits_properties, + :meta_keywords, :notes, :inherits_properties, { product_properties_attributes: [:id, :property_name, :value], variants_attributes: [PermittedAttributes::Variant.attributes], images_attributes: [:attachment] } diff --git a/app/views/spree/admin/products/_seo_form.html.haml b/app/views/spree/admin/products/_seo_form.html.haml index 36130af852..87358437f5 100644 --- a/app/views/spree/admin/products/_seo_form.html.haml +++ b/app/views/spree/admin/products/_seo_form.html.haml @@ -5,11 +5,6 @@ %span.icon-question-sign{ 'ofn-with-tip' => t('admin.products.seo.product_search_tip') } %br/ = f.text_field :meta_keywords, :class => 'fullwidth', :rows => 6 - = f.field_container :meta_description do - = f.label :meta_description, t('admin.products.seo.SEO_keywords') - %span.icon-question-sign{ 'ofn-with-tip' => t('admin.products.seo.seo_tip') } - %br/ - = f.text_field :meta_description, :class => 'fullwidth', :rows => 6 .alpha.eleven.columns = f.field_container :notes do = f.label :notes, t(:notes) diff --git a/config/locales/en.yml b/config/locales/en.yml index 5a9001e7a4..e69f2f8464 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -728,7 +728,6 @@ en: seo: product_search_keywords: "Product Search Keywords" product_search_tip: "Type words to help search your products in the shops. Use space to separate each keyword." - SEO_keywords: "SEO Keywords" seo_tip: "Type words to help search your products in the web. Use space to separate each keyword." search: "Search" properties: diff --git a/spec/javascripts/unit/admin/bulk_product_update_spec.js.coffee b/spec/javascripts/unit/admin/bulk_product_update_spec.js.coffee index 00ee9c2b58..e814c53afa 100644 --- a/spec/javascripts/unit/admin/bulk_product_update_spec.js.coffee +++ b/spec/javascripts/unit/admin/bulk_product_update_spec.js.coffee @@ -192,7 +192,6 @@ describe "filtering products for submission to database", -> available_on: available_on deleted_at: null permalink: null - meta_description: null meta_keywords: null tax_category_id: null shipping_category_id: null @@ -998,7 +997,6 @@ describe "AdminProductEditCtrl", -> deleted_at: null permalink: 'test-product' permalink_live: 'test-product' - meta_description: null meta_keywords: null tax_category_id: null shipping_category_id: null From 6f83607aa8dd23c8b249ef3e000fd577a23149fc Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 15 Mar 2023 14:18:53 +1100 Subject: [PATCH 2/2] Remove unused product meta description from DB --- app/models/spree/product.rb | 2 -- ...0315031807_remove_meta_description_from_spree_products.rb | 5 +++++ db/schema.rb | 3 +-- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20230315031807_remove_meta_description_from_spree_products.rb diff --git a/app/models/spree/product.rb b/app/models/spree/product.rb index 9d4bd99f0a..4e603ab48c 100755 --- a/app/models/spree/product.rb +++ b/app/models/spree/product.rb @@ -27,8 +27,6 @@ module Spree include PermalinkGenerator include ProductStock - self.ignored_columns = [:meta_description] - acts_as_paranoid searchable_attributes :supplier_id, :primary_taxon_id, :meta_keywords diff --git a/db/migrate/20230315031807_remove_meta_description_from_spree_products.rb b/db/migrate/20230315031807_remove_meta_description_from_spree_products.rb new file mode 100644 index 0000000000..3b7d48554f --- /dev/null +++ b/db/migrate/20230315031807_remove_meta_description_from_spree_products.rb @@ -0,0 +1,5 @@ +class RemoveMetaDescriptionFromSpreeProducts < ActiveRecord::Migration[6.1] + def change + remove_column :spree_products, :meta_description, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index 75cccc9216..803238dc31 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_02_13_160135) do +ActiveRecord::Schema[7.0].define(version: 2023_03_15_031807) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "plpgsql" @@ -718,7 +718,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_13_160135) do t.datetime "available_on", precision: nil t.datetime "deleted_at", precision: nil t.string "permalink", limit: 255 - t.text "meta_description" t.string "meta_keywords", limit: 255 t.integer "tax_category_id" t.integer "shipping_category_id"