From 5d2a5e63ec04dd91503eaed41c17d5b38addc301 Mon Sep 17 00:00:00 2001 From: SarvarKhalimov Date: Tue, 9 Nov 2021 18:49:53 +0500 Subject: [PATCH] Fix the issue with 'at' in interprise twitter and insgram --- app/models/enterprise.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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?