Files
openfoodnetwork/app/services/terms_of_service.rb
Maikel Linke 4a0ed99919 Replace Paperclip on Enterprise model
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.
2022-06-01 17:16:55 +10:00

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