Fix the issue with 'at' in interprise twitter and insgram

This commit is contained in:
SarvarKhalimov
2021-11-09 18:49:53 +05:00
committed by Maikel Linke
parent 0a22a3baa6
commit 5d2a5e63ec

View File

@@ -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?