roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Update Handling of `contact_us_url` in `def app_email`

Open aaronskiba opened this issue 2 years ago • 0 comments

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0)

  • 4.1.1

Description

  • The value for contact_us_url is set via the contact_us gem. If we want to define a custom value for this, the codebase also allows us to do so via Rails.application.config.x.organisation.contact_us_url.
  • Throughout the codebase, there are many statements similar to the following:
    contact_us = Rails.configuration.x.organisation.contact_us_url || contact_us_url
    
  • However, there is one exception to this in app/services/extermal_apis/base_service.rb:
      def app_email
        dflt = Rails.application.routes.url_helpers.contact_us_url || ''
        Rails.configuration.x.organisation.fetch(:helpdesk_email, dflt)
      end
  • The problem here is that, like contact_us_url, the value for Rails.application.routes.url_helpers.contact_us_url is is set via the contact_us gem. If we again want allow for a custom defined valued, then maybe we should change the code to the following:
      def app_email
        dflt = Rails.configuration.x.organisation.contact_us_url || contact_us_url
        Rails.configuration.x.organisation.fetch(:helpdesk_email, dflt)
      end

aaronskiba avatar Feb 13 '24 17:02 aaronskiba