docbrown/app/models/forem_instance.rb
Ridhwana 5e93d3a25e
Add a contact email address to the /admin/customization/config (#16497)
* feat: remove the default email and cobine the periodic digest and the contact email under the Email section

* refactor: rename  the email_link to contact link and use the contact_email as a default and fallback to the ForemInstance.email

* chore: alignment

* feat: use the contact_email helper

* feat: move the contact_email to the ForemInstance model

* feat: use ForemInstance.contact_email instead of the application helper method

* removed the application Helper

* feat: set the dafault on the contact_email

* fix: cypress tests

* Update app/lib/constants/settings/general.rb

Co-authored-by: Michael Kohl <me@citizen428.net>

Co-authored-by: Michael Kohl <me@citizen428.net>
2022-02-15 17:37:08 +02:00

46 lines
1.2 KiB
Ruby

class ForemInstance
def self.deployed_at
@deployed_at ||= ApplicationConfig["RELEASE_FOOTPRINT"].presence ||
ENV["HEROKU_RELEASE_CREATED_AT"].presence ||
Time.current.to_s
end
def self.latest_commit_id
@latest_commit_id ||= ApplicationConfig["FOREM_BUILD_SHA"].presence || ENV["HEROKU_SLUG_COMMIT"].presence
end
def self.email
ApplicationConfig["DEFAULT_EMAIL"]
end
def self.contact_email
Settings::General.contact_email
end
# Return true if we are operating on a local installation, false otherwise
def self.local?
Settings::General.app_domain.include?("localhost")
end
# Used where we need to keep old DEV features around but don't want to/cannot
# expose them to other communities.
def self.dev_to?
Settings::General.app_domain == "dev.to"
end
def self.smtp_enabled?
Settings::SMTP.provided_minimum_settings? || ENV["SENDGRID_API_KEY"].present?
end
def self.invitation_only?
Settings::Authentication.invite_only_mode?
end
def self.private?
!Settings::UserExperience.public?
end
def self.needs_owner_secret?
ENV["FOREM_OWNER_SECRET"].present? && Settings::General.waiting_on_first_user
end
end