diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 77b49a9110..beffa5ba4c 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -290,6 +290,14 @@ class Enterprise < ApplicationRecord strip_url self[:linkedin] end + def twitter + correct_social_url self[:twitter] + end + + def instagram + correct_social_url self[:instagram] + end + def inventory_variants if prefers_product_selection_from_inventory_only? Spree::Variant.visible_for(self) @@ -420,6 +428,10 @@ class Enterprise < ApplicationRecord url&.sub(%r{(https?://)?}, '') end + def correct_social_url(url) + url&.include?("@") ? url.delete!("@") : url + end + def set_unused_address_fields address.firstname = address.lastname = address.phone = address.company = 'unused' if address.present? business_address.first_name = business_address.last_name = 'unused' if business_address.present?