mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
We configured Paperclip to convert images to JPG in some cases but I omitted that here because we don't need it. If an image is better represented as PNG or another format then the user should be able to choose that. Some specs were also testing the generated URL but the Active Storage URL doesn't contain a style name anymore and it's not helpful to test the URL.
26 lines
697 B
Ruby
26 lines
697 B
Ruby
# frozen_string_literal: true
|
|
|
|
class TermsOfService
|
|
def self.tos_accepted?(customer, distributor = nil)
|
|
return false unless accepted_at = customer&.terms_and_conditions_accepted_at
|
|
|
|
accepted_at > if distributor
|
|
distributor.terms_and_conditions_blob.created_at
|
|
else
|
|
TermsOfServiceFile.updated_at
|
|
end
|
|
end
|
|
|
|
def self.required?(distributor)
|
|
platform_terms_required? || distributor_terms_required?(distributor)
|
|
end
|
|
|
|
def self.platform_terms_required?
|
|
Spree::Config.shoppers_require_tos
|
|
end
|
|
|
|
def self.distributor_terms_required?(distributor)
|
|
distributor.terms_and_conditions.attached?
|
|
end
|
|
end
|