docbrown/app/models/forem_instance.rb
Julianna Tetreault e1e18aa0aa
[15-Minute Fix] Ensure "Locked Screen" Checkbox Conditionally Renders (#14161)
* Uses Settings::UserExperience.public to conditionally render btn

* Updates landing page-related specs to account for private forem

* Uses Settings::UserExperience in place of ForemInstance in admin_creates_new_page_spec.rb

* Reverts Settings::UserExperience.public? changes throughout codebase
  - Removes any changes to ForemInstance.private?
  - Adds a new helper method, self.invitation_only?
  - Updates self.private? logic

* Updates landing page specs and reverts unnecessary changes
  - Reverts any changes that removed the check for
ForemInstance.private?
  - Updates landingPage.spec.js to use findByRole rather
than findByText

* Reverts a change to admin_manages_pages_spec.rb

* Updates landingPage.spec.js per PR review comment

* Updates #private_forem_or_no_enabled_auth_options and spec

* Uses .invite_only? in _providers_registration_form.html.erb

* Adjusts authenticationSection.spec.js to test that FB is enabled

* Updates necessary specs to check .invitation_only?

* Consistently uses invite_only_mode_or_no_enabled_auth_options
  - Updates all necessary places within the codebase to use
reverted method name, invite_only_mode_or_no_enabled_auth_providers
  - Updates #self.enabled to check ForemInstance.invitation_only?
rather than ForemInstance.private?
  - Reverts change to Facebook assertion within authenticationSection
e2e test

* Removes superfluous .to from authenticationSection.spec.js
2021-07-12 14:14:43 -06:00

38 lines
1 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
# 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.user_name.present? && Settings::SMTP.password.present?) || ENV["SENDGRID_API_KEY"].present?
end
def self.invitation_only?
Settings::Authentication.invite_only_mode?
end
def self.private?
!Settings::UserExperience.public?
end
end