mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Don't cast remove image parameters to booleans.
This commit is contained in:
@@ -270,15 +270,15 @@ class Enterprise < ApplicationRecord
|
||||
end
|
||||
|
||||
def remove_logo=(value)
|
||||
self.logo = nil if truthy?(value)
|
||||
self.logo = nil if value == "1"
|
||||
end
|
||||
|
||||
def remove_promo_image=(value)
|
||||
self.promo_image = nil if truthy?(value)
|
||||
self.promo_image = nil if value == "1"
|
||||
end
|
||||
|
||||
def remove_white_label_logo=(value)
|
||||
return if !truthy?(value)
|
||||
return unless value == "1"
|
||||
|
||||
self.white_label_logo = nil
|
||||
self.white_label_logo_link = nil # Link not needed if there's no logo
|
||||
@@ -492,10 +492,6 @@ class Enterprise < ApplicationRecord
|
||||
|
||||
private
|
||||
|
||||
def truthy?(value)
|
||||
ActiveModel::Type::Boolean.new.cast(value)
|
||||
end
|
||||
|
||||
def validate_white_label_logo_link
|
||||
return if white_label_logo.blank?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user