mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
use phoneRequired from settings instead of env
This commit is contained in:
parent
f80eb230ca
commit
13bcd9a1f8
@ -1019,7 +1019,7 @@ angular.module('application.router', ['ui.router'])
|
||||
'fablab_name', 'name_genre', 'reminder_enable', \
|
||||
'reminder_delay', 'visibility_yearly', 'visibility_others', \
|
||||
'display_name_enable', 'machines_sort_by', 'fab_analytics', \
|
||||
'link_name', 'home_content', 'home_css']` }).$promise;
|
||||
'link_name', 'home_content', 'home_css', 'phone_required']` }).$promise;
|
||||
}],
|
||||
privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }],
|
||||
cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }],
|
||||
|
@ -93,11 +93,17 @@ class Setting < ApplicationRecord
|
||||
end
|
||||
|
||||
##
|
||||
# Return the value of the requested setting
|
||||
# Return the value of the requested setting, if any.
|
||||
# Usage: Setting.get('my_setting')
|
||||
# @return {string}
|
||||
# @return {String}
|
||||
##
|
||||
def self.get(name)
|
||||
find_by(name: name)&.value
|
||||
res = find_by(name: name)&.value
|
||||
|
||||
# handle boolean values
|
||||
return true if res == 'true'
|
||||
return false if res == 'false'
|
||||
|
||||
res
|
||||
end
|
||||
end
|
||||
|
@ -203,7 +203,7 @@ class User < ApplicationRecord
|
||||
def need_completion?
|
||||
statistic_profile.gender.nil? || profile.first_name.blank? || profile.last_name.blank? || username.blank? ||
|
||||
email.blank? || encrypted_password.blank? || group_id.nil? || statistic_profile.birthday.blank? ||
|
||||
(Rails.application.secrets.phone_required && profile.phone.blank?)
|
||||
(Setting.get('phone_required') && profile.phone.blank?)
|
||||
end
|
||||
|
||||
## Retrieve the requested data in the User and user's Profile tables
|
||||
|
@ -27,7 +27,7 @@
|
||||
Fablab.withoutSpaces = ('<%= Rails.application.secrets.fablab_without_spaces %>' !== 'false');
|
||||
Fablab.withoutOnlinePayment = ('<%= Rails.application.secrets.fablab_without_online_payments %>' === 'true');
|
||||
Fablab.withoutInvoices = ('<%= Rails.application.secrets.fablab_without_invoices %>' === 'true');
|
||||
Fablab.phoneRequired = ('<%= Rails.application.secrets.phone_required %>' === 'true');
|
||||
Fablab.phoneRequired = ('<%= Setting.get('phone_required') %>' === 'true');
|
||||
Fablab.fablabWithoutWallet = ('<%= Rails.application.secrets.fablab_without_wallet %>' === 'true');
|
||||
Fablab.bookSlotAtSameTime = ('<%= Rails.application.secrets.book_slot_at_same_time %>' === 'true');
|
||||
Fablab.eventsInCalendar = ('<%= Rails.application.secrets.events_in_calendar %>' === 'true');
|
||||
|
@ -20,7 +20,6 @@ development:
|
||||
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
||||
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
|
||||
phone_required: <%= ENV["PHONE_REQUIRED"] %>
|
||||
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
|
||||
book_slot_at_same_time: <%= ENV["BOOK_SLOT_AT_SAME_TIME"] %>
|
||||
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
|
||||
@ -68,7 +67,6 @@ test:
|
||||
fablab_without_spaces: false
|
||||
fablab_without_online_payments: false
|
||||
fablab_without_invoices: false
|
||||
phone_required: true
|
||||
fablab_without_wallet: false
|
||||
book_slot_at_same_time: true
|
||||
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
|
||||
@ -116,7 +114,6 @@ staging:
|
||||
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
||||
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
|
||||
phone_required: <%= ENV["PHONE_REQUIRED"] %>
|
||||
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
|
||||
book_slot_at_same_time: <%= ENV["BOOK_SLOT_AT_SAME_TIME"] %>
|
||||
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
|
||||
@ -176,7 +173,6 @@ production:
|
||||
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
||||
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||
fablab_without_invoices: <%= ENV["FABLAB_WITHOUT_INVOICES"] %>
|
||||
phone_required: <%= ENV["PHONE_REQUIRED"] %>
|
||||
fablab_without_wallet: <%= ENV["FABLAB_WITHOUT_WALLET"] %>
|
||||
book_slot_at_same_time: <%= ENV["BOOK_SLOT_AT_SAME_TIME"] %>
|
||||
user_confirmation_needed_to_sign_in: <%= ENV["USER_CONFIRMATION_NEEDED_TO_SIGN_IN"] %>
|
||||
|
@ -925,6 +925,12 @@ unless Setting.find_by(name: 'link_name').try(:value)
|
||||
setting.save
|
||||
end
|
||||
|
||||
unless Setting.find_by(name: 'phone_required').try(:value)
|
||||
setting = Setting.find_or_initialize_by(name: 'phone_required')
|
||||
setting.value = 'true'
|
||||
setting.save
|
||||
end
|
||||
|
||||
unless Setting.find_by(name: 'home_content').try(:value)
|
||||
setting = Setting.find_or_initialize_by(name: 'home_content')
|
||||
setting.value = <<~HTML
|
||||
|
Loading…
x
Reference in New Issue
Block a user