Make use of ENV.fetch
This commit is contained in:
parent
200d188af2
commit
36b23ce25d
27 changed files with 51 additions and 53 deletions
|
|
@ -42,7 +42,7 @@ class Ability
|
|||
can [:index, :show], Survey, surveyable_type: 'Conference'
|
||||
|
||||
# Things that are possible without ichain enabled that are **not*+ possible with ichain mode enabled.
|
||||
if ENV['OSEM_ICHAIN_ENABLED'] != 'true'
|
||||
if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) != 'true'
|
||||
# There is no reliable way for this workflow (enable not logged in users to fill out a form, then telling
|
||||
# them to sign up once they submit) in ichain. So enable it only without ichain.
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class AdminAbility
|
|||
# for admins
|
||||
can :manage, :all if user.is_admin
|
||||
# even admin cannot create new users with ICHAIN enabled
|
||||
cannot [:new, :create], User if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||
cannot [:new, :create], User if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
|
||||
cannot :revert_object, PaperTrail::Version do |version|
|
||||
(version.event == 'create' && %w[Conference User Event].include?(version.item_type))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ class EmailSettings < ApplicationRecord
|
|||
'conference_start_date' => conference.start_date,
|
||||
'conference_end_date' => conference.end_date,
|
||||
'registrationlink' => Rails.application.routes.url_helpers.conference_conference_registration_url(
|
||||
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')),
|
||||
conference.short_title, host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000')),
|
||||
'conference_splash_link' => Rails.application.routes.url_helpers.conference_url(
|
||||
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')),
|
||||
conference.short_title, host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000')),
|
||||
|
||||
'schedule_link' => Rails.application.routes.url_helpers.conference_schedule_url(
|
||||
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000'))
|
||||
conference.short_title, host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000'))
|
||||
}
|
||||
|
||||
if conference.program.cfp
|
||||
|
|
@ -45,7 +45,7 @@ class EmailSettings < ApplicationRecord
|
|||
if event
|
||||
h['eventtitle'] = event.title
|
||||
h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposals_url(
|
||||
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000'))
|
||||
conference.short_title, host: ENV.fetch('OSEM_HOSTNAME', 'localhost:3000'))
|
||||
end
|
||||
|
||||
if booth
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class User < ApplicationRecord
|
|||
# :lockable, :timeoutable and :omniauthable
|
||||
devise_modules = []
|
||||
|
||||
devise_modules += if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
|
||||
devise_modules += if ENV.fetch('OSEM_ICHAIN_ENABLED', nil) == 'true'
|
||||
[:ichain_authenticatable, :ichain_registerable, :omniauthable, omniauth_providers: []]
|
||||
else
|
||||
[:database_authenticatable, :registerable,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue