2020-03-21 15:36:33 +00:00
|
|
|
class AskSetting
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
2022-03-18 03:49:11 +00:00
|
|
|
All_default_fields = ['ask_category_id','name','sex','mail','phone','appointment','recaptcha','usage_rule','agree_show','agree_usage']
|
2022-08-18 03:07:45 +00:00
|
|
|
No_prompt_word = ['ask_category_id', 'sex', 'appointment', 'recaptcha']
|
|
|
|
No_required = ['agree_show']
|
|
|
|
before_save do
|
|
|
|
if self.sort_number_changed?
|
|
|
|
self.sort_number = self.sort_number.map{|k,v| [k,v.to_i]}.sort_by{|k,v| v}.to_h
|
2023-02-07 11:44:05 +00:00
|
|
|
need_recalc_sort = true
|
|
|
|
else
|
|
|
|
need_recalc_sort = false
|
2022-08-18 03:07:45 +00:00
|
|
|
end
|
|
|
|
@email_regex_enable_changed = self.email_regex_enable_changed?
|
|
|
|
@email_regex_changed = self.email_regex_changed?
|
|
|
|
@default_setting_prompt_word_changed = self.default_setting_prompt_word_changed?
|
|
|
|
@default_setting_field_name_changed = self.default_setting_field_name_changed?
|
|
|
|
@custom_fields_changed = self.custom_fields_changed?
|
|
|
|
if @custom_fields_changed
|
|
|
|
@delete_custom_fields = self.custom_fields.select{|k,v| v['delete'] == true}.keys
|
|
|
|
@delete_custom_fields.each{|f| self.sort_number.delete(f)}
|
|
|
|
self.custom_fields = self.custom_fields.select{|k,v| v['delete'] != true}
|
2023-02-07 11:44:05 +00:00
|
|
|
need_recalc_sort = true
|
|
|
|
end
|
2023-11-06 23:59:49 +00:00
|
|
|
# if need_recalc_sort
|
|
|
|
self.recalc_sort(false)
|
|
|
|
# end
|
2022-08-18 03:07:45 +00:00
|
|
|
true
|
2022-05-25 06:19:05 +00:00
|
|
|
end
|
2022-08-18 03:07:45 +00:00
|
|
|
after_save do
|
|
|
|
update_all_hash = {}
|
|
|
|
if @email_regex_enable_changed || @email_regex_changed
|
|
|
|
update_all_hash[:email_regex_enable] = self.email_regex_enable
|
|
|
|
update_all_hash[:email_regex] = self.email_regex
|
|
|
|
end
|
|
|
|
if @default_setting_prompt_word_changed
|
|
|
|
update_all_hash[:default_setting_prompt_word] = self.default_setting_prompt_word
|
|
|
|
end
|
|
|
|
if @default_setting_field_name_changed
|
|
|
|
update_all_hash[:default_setting_field_name] = self.default_setting_field_name
|
|
|
|
end
|
|
|
|
if update_all_hash.present?
|
|
|
|
AskCategorySetting.all.update_all(update_all_hash)
|
|
|
|
end
|
|
|
|
if @custom_fields_changed
|
|
|
|
AskCategorySetting.all.each do |a|
|
|
|
|
a.delete_customs_func(@delete_custom_fields)
|
|
|
|
a.update_need_check_customs(self.custom_fields)
|
|
|
|
end
|
|
|
|
end
|
2020-03-21 15:36:33 +00:00
|
|
|
end
|
2023-02-07 11:44:05 +00:00
|
|
|
def use_default
|
|
|
|
false
|
|
|
|
end
|
|
|
|
def migrate_old
|
|
|
|
unless self.new_record?
|
|
|
|
if self.default_setting.class != Hash && self.default_setting.class != BSON::Document
|
|
|
|
self.default_setting = {}
|
|
|
|
end
|
|
|
|
if self.default_setting[:agree_show].nil?
|
|
|
|
self.default_setting[:agree_show] = true
|
|
|
|
end
|
|
|
|
if self.default_setting[:agree_usage].nil?
|
|
|
|
self.default_setting[:agree_usage] = false
|
|
|
|
end
|
|
|
|
if self.custom_fields.class != Hash && self.custom_fields.class != BSON::Document
|
|
|
|
self.custom_fields = {}
|
|
|
|
end
|
|
|
|
self.recalc_sort(true)
|
|
|
|
end
|
|
|
|
end
|
2022-03-18 03:49:11 +00:00
|
|
|
def field_name(k,locale=I18n.locale.to_s,use_checkbox_trans=false)
|
|
|
|
tmp = self.default_setting_field_name[k]
|
|
|
|
(tmp&&tmp[locale]) ? tmp[locale] : self.default_field_name(k,locale)
|
2022-03-09 17:00:05 +00:00
|
|
|
end
|
2022-08-18 03:07:45 +00:00
|
|
|
def is_required(k)
|
|
|
|
self.default_setting_required[k]
|
|
|
|
end
|
2022-03-18 03:49:11 +00:00
|
|
|
def default_field_name(k,locale=I18n.locale.to_s,use_checkbox_trans=false)
|
2022-10-14 14:33:04 +00:00
|
|
|
I18n.with_locale(locale){ (use_checkbox_trans && ['agree_show','agree_usage'].include?(k.to_s)) ? I18n.t("ask.#{k}_checkbox") : ['serial_number','situation','ip'].include?(k) ? I18n.t("ask.#{k}") : I18n.t("mongoid.attributes.ask_question.#{k}")}
|
2022-03-09 17:00:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def field_name_translations(k)
|
|
|
|
I18n.available_locales.map{|v| [v.to_s,self.field_name(k,v.to_s)]}.to_h
|
|
|
|
end
|
2022-08-18 03:07:45 +00:00
|
|
|
def prompt_word(k,locale=I18n.locale.to_s,use_checkbox_trans=false)
|
|
|
|
tmp = self.default_setting_prompt_word[k]
|
|
|
|
(tmp&&tmp[locale]) ? tmp[locale] : self.field_name(k,locale)
|
|
|
|
end
|
|
|
|
|
|
|
|
def prompt_word_translations(k)
|
|
|
|
I18n.available_locales.map{|v| [v.to_s,self.prompt_word(k,v.to_s)]}.to_h
|
|
|
|
end
|
2022-04-12 14:17:34 +00:00
|
|
|
field :email_regex_enable, type: Boolean, default: false
|
|
|
|
field :email_regex, type: String, default: '\A[^@\s]+@([^@.\s]+\.)+[^@.\s]+\z'
|
2023-02-07 11:44:05 +00:00
|
|
|
field :tmp_sort_number, type: Hash, default: {}
|
2022-03-18 03:49:11 +00:00
|
|
|
field :sort_number, type: Hash, default: {}
|
2022-07-07 08:54:09 +00:00
|
|
|
field :default_setting, type: Hash,default: {title:true,ask_category_id: true,name: true,sex: true,mail: true,phone: true,appointment: true,recaptcha: true,agree_show: true,agree_usage: true}
|
2022-08-18 03:07:45 +00:00
|
|
|
field :default_setting_required, type: Hash,default: {title:true,ask_category_id: true,name: true,sex: true,mail: true,phone: false,appointment: false,recaptcha: true,agree_show: false,agree_usage: true}
|
2022-03-09 17:00:05 +00:00
|
|
|
field :default_setting_field_name, type: Hash,default: {}
|
2022-08-18 03:07:45 +00:00
|
|
|
field :default_setting_prompt_word, type: Hash,default: {}
|
2022-03-09 17:00:05 +00:00
|
|
|
|
2022-09-21 10:07:01 +00:00
|
|
|
field :custom_fields, type: Hash, default: {}
|
|
|
|
field :usage_rule, type: String, default: ''
|
|
|
|
field :title_layout, type: Integer, default: 0
|
2022-07-07 08:54:09 +00:00
|
|
|
field :last_ticket_key, type: Integer, default: 0
|
2022-08-18 03:07:45 +00:00
|
|
|
field :last_serial_number, type: Integer, default: 0
|
2023-02-07 11:44:05 +00:00
|
|
|
def recalc_sort(save_flag=true)
|
|
|
|
self.tmp_sort_number = AskSetting.get_sort_number_only(true, self, true).map.with_index{|(k,v), i| [k,i]}.to_h
|
|
|
|
self.save if save_flag
|
|
|
|
end
|
|
|
|
def get_cache_sort_number #For Frontend
|
|
|
|
if self.tmp_sort_number.blank?
|
|
|
|
self.recalc_sort
|
|
|
|
end
|
|
|
|
self.tmp_sort_number
|
|
|
|
end
|
2022-03-26 04:33:49 +00:00
|
|
|
def get_attrs
|
|
|
|
attrs = self.attributes.clone
|
|
|
|
self.fields.each do |k, v|
|
|
|
|
if (v.options[:localize] rescue false)
|
|
|
|
attrs["#{k}_translations"] = attrs[k]
|
|
|
|
attrs.delete(k)
|
|
|
|
end
|
|
|
|
end
|
2022-08-18 03:07:45 +00:00
|
|
|
attrs.except("_type","_id","uid","updated_at", "created_at", "email_regex", "last_ticket_key", "default_setting_required", "last_serial_number")
|
|
|
|
end
|
|
|
|
def self.update_last_serial_number(last_serial_number=nil)
|
|
|
|
can_update_shared_hash = (defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash)
|
|
|
|
if last_serial_number.nil?
|
2023-02-07 11:44:05 +00:00
|
|
|
last_serial_number = (can_update_shared_hash ? OrbitHelper::SharedHash["ask"][:last_serial_number] : self.pluck(:last_serial_number)[0].to_i)
|
|
|
|
self.all.inc({'last_serial_number'=>1})
|
2022-08-18 03:07:45 +00:00
|
|
|
last_serial_number += 1
|
|
|
|
else
|
2023-02-07 11:44:05 +00:00
|
|
|
self.all.update_all(:last_serial_number=>last_serial_number)
|
2022-08-18 03:07:45 +00:00
|
|
|
end
|
|
|
|
if can_update_shared_hash
|
|
|
|
OrbitHelper::SharedHash["ask"][:last_serial_number] = last_serial_number
|
|
|
|
end
|
|
|
|
last_serial_number
|
2022-03-26 04:33:49 +00:00
|
|
|
end
|
2023-02-07 11:44:05 +00:00
|
|
|
def self.get_sort_number_only(only_display=true, cat=nil, cat_is_record=false, override_sort_number=nil, use_cache=false)
|
|
|
|
ask_setting = nil
|
|
|
|
if cat_is_record
|
|
|
|
ask_setting = cat
|
|
|
|
is_cat_record = !(override_sort_number.nil?) || cat.class == AskCategorySetting
|
|
|
|
else
|
|
|
|
if cat.present?
|
|
|
|
ask_setting = AskCategorySetting.enabled.where(:category_id=>cat).first
|
|
|
|
is_cat_record = true
|
|
|
|
end
|
|
|
|
ask_setting = self.first if ask_setting.nil?
|
|
|
|
ask_setting = self.create() if ask_setting.nil?
|
|
|
|
end
|
|
|
|
if only_display && use_cache
|
|
|
|
if override_sort_number
|
|
|
|
sort_number = override_sort_number
|
|
|
|
else
|
|
|
|
sort_number = ask_setting.get_cache_sort_number
|
|
|
|
end
|
|
|
|
return sort_number
|
|
|
|
end
|
2023-02-10 05:34:07 +00:00
|
|
|
is_default_setting = (ask_setting.class == self)
|
2023-02-07 11:44:05 +00:00
|
|
|
if override_sort_number.present?
|
|
|
|
sort_number = override_sort_number
|
|
|
|
else
|
|
|
|
sort_number = ask_setting.sort_number
|
|
|
|
if ask_setting.use_default
|
|
|
|
if ask_setting.default_sort_number.blank?
|
2023-02-10 05:34:07 +00:00
|
|
|
sort_number = (is_default_setting ? sort_number : self.first.sort_number)
|
2023-02-07 11:44:05 +00:00
|
|
|
else
|
|
|
|
sort_number = ask_setting.default_sort_number
|
|
|
|
end
|
|
|
|
override_sort_number = sort_number
|
|
|
|
ask_setting = self.first
|
|
|
|
end
|
|
|
|
end
|
2023-02-10 05:34:07 +00:00
|
|
|
default_ask_setting = is_default_setting ? ask_setting : self.first
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields = self::All_default_fields
|
|
|
|
disp_fields_infos = {}
|
|
|
|
locale = I18n.locale.to_s
|
|
|
|
if !only_display || ask_setting.default_setting['title'] != false
|
|
|
|
disp_fields_infos['title'] = sort_number['title'].to_i
|
|
|
|
end
|
|
|
|
tmp = disp_fields[0...-4]
|
|
|
|
if only_display
|
|
|
|
tmp = tmp.select{|f| ask_setting.default_setting[f]}
|
|
|
|
end
|
|
|
|
tmp.each do |f|
|
|
|
|
disp_fields_infos[f] = sort_number[f]
|
|
|
|
end
|
|
|
|
tmp_locales = I18n.available_locales.map{|l| l.to_s}
|
|
|
|
tmp_locales = [locale] + (tmp_locales - [locale])
|
|
|
|
ask_setting.custom_fields.each do |k,v|
|
2023-05-20 15:25:00 +00:00
|
|
|
tmp_k = k
|
|
|
|
if !k.start_with?('default@')
|
|
|
|
prefix = is_cat_record ? "custom@#{cat.id}@" : 'default@'
|
|
|
|
tmp_k = "#{prefix}#{k}"
|
|
|
|
end
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields_infos[tmp_k] = sort_number[tmp_k]
|
|
|
|
end
|
|
|
|
ask_category_settings = []
|
|
|
|
if is_cat_record
|
|
|
|
ask_category_settings = []
|
|
|
|
else
|
|
|
|
ask_category_settings = AskCategorySetting.enabled.to_a
|
|
|
|
end
|
|
|
|
ask_category_settings.each do |c|
|
2023-05-20 15:25:00 +00:00
|
|
|
category = Category.find(c.category_id) rescue nil
|
|
|
|
if category.nil?
|
2023-02-07 11:44:05 +00:00
|
|
|
c.destroy
|
|
|
|
next
|
|
|
|
end
|
|
|
|
c.custom_fields.each do |k,v|
|
|
|
|
next if k.start_with?('default@')
|
|
|
|
tmp_k = "custom@#{c.id}@#{k}"
|
2023-05-20 15:25:00 +00:00
|
|
|
cat_title = category.title rescue ""
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields_infos[tmp_k] = sort_number[tmp_k]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
tmp = disp_fields[-4..-1]
|
|
|
|
if only_display
|
|
|
|
tmp = tmp.select{|f| ask_setting.default_setting[f] || f == 'usage_rule'}
|
|
|
|
end
|
|
|
|
tmp.each do |f|
|
|
|
|
disp_fields_infos[f] = sort_number[f]
|
|
|
|
end
|
|
|
|
max_sort_number = disp_fields_infos.values.map{|v| v}.compact.max
|
|
|
|
if max_sort_number
|
2023-02-10 05:34:07 +00:00
|
|
|
if !use_cache || (is_default_setting && override_sort_number.nil?)
|
|
|
|
max_sort_number = max_sort_number + 1
|
|
|
|
disp_fields_infos.each_with_index do |(k,v), i|
|
|
|
|
if v.blank?
|
|
|
|
disp_fields_infos[k] = max_sort_number + i
|
|
|
|
end
|
2023-02-07 11:44:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
disp_fields_infos = disp_fields_infos.sort_by {|_key, value| value}.to_h
|
|
|
|
end
|
|
|
|
disp_fields_infos
|
|
|
|
end
|
|
|
|
def self.get_disp_fields_infos(only_display=true, cat=nil, cat_is_record=false, override_sort_number=nil, use_cache=false)
|
2022-03-26 04:33:49 +00:00
|
|
|
ask_setting = nil
|
2023-02-07 11:44:05 +00:00
|
|
|
if cat_is_record
|
|
|
|
ask_setting = cat
|
|
|
|
is_cat_record = !(override_sort_number.nil?) || cat.class == AskCategorySetting
|
|
|
|
else
|
|
|
|
if cat.present?
|
|
|
|
ask_setting = AskCategorySetting.enabled.where(:category_id=>cat).first
|
|
|
|
is_cat_record = true
|
|
|
|
end
|
|
|
|
ask_setting = self.first if ask_setting.nil?
|
|
|
|
ask_setting = self.create() if ask_setting.nil?
|
|
|
|
end
|
2023-02-10 05:34:07 +00:00
|
|
|
is_default_setting = (ask_setting.class == self)
|
2023-02-07 11:44:05 +00:00
|
|
|
sort_number = nil
|
|
|
|
if only_display && use_cache
|
|
|
|
if override_sort_number
|
|
|
|
sort_number = override_sort_number
|
|
|
|
else
|
|
|
|
sort_number = ask_setting.get_cache_sort_number
|
|
|
|
end
|
|
|
|
else
|
|
|
|
use_cache = false
|
|
|
|
sort_number = ask_setting.sort_number
|
|
|
|
if override_sort_number.present?
|
|
|
|
sort_number = override_sort_number
|
|
|
|
elsif ask_setting.use_default
|
|
|
|
if ask_setting.default_sort_number.blank?
|
2023-02-10 05:34:07 +00:00
|
|
|
sort_number = (is_default_setting ? sort_number : self.first.sort_number)
|
2023-02-07 11:44:05 +00:00
|
|
|
else
|
|
|
|
sort_number = ask_setting.default_sort_number
|
|
|
|
end
|
|
|
|
override_sort_number = sort_number
|
|
|
|
ask_setting = self.first
|
|
|
|
end
|
2022-03-26 04:33:49 +00:00
|
|
|
end
|
2023-02-10 05:34:07 +00:00
|
|
|
default_ask_setting = is_default_setting ? ask_setting : self.first
|
2022-03-18 03:49:11 +00:00
|
|
|
disp_fields = self::All_default_fields
|
|
|
|
disp_fields_infos = {}
|
|
|
|
locale = I18n.locale.to_s
|
2022-08-18 03:07:45 +00:00
|
|
|
if !only_display || ask_setting.default_setting['title'] != false
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields_infos['title'] = {"trans"=>ask_setting.field_name('title'), "sort_number"=>sort_number['title'].to_i}
|
2022-08-18 03:07:45 +00:00
|
|
|
end
|
2022-07-07 08:54:09 +00:00
|
|
|
tmp = disp_fields[0...-4]
|
|
|
|
if only_display
|
|
|
|
tmp = tmp.select{|f| ask_setting.default_setting[f]}
|
|
|
|
end
|
|
|
|
tmp.each do |f|
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields_infos[f] = {"trans"=>default_ask_setting.field_name(f,locale),"sort_number"=>sort_number[f]}
|
2022-03-18 03:49:11 +00:00
|
|
|
end
|
|
|
|
tmp_locales = I18n.available_locales.map{|l| l.to_s}
|
|
|
|
tmp_locales = [locale] + (tmp_locales - [locale])
|
|
|
|
ask_setting.custom_fields.each do |k,v|
|
|
|
|
trans = v["field"]
|
|
|
|
tmp_locales.each do |l|
|
2022-08-18 03:07:45 +00:00
|
|
|
if trans[l].present?
|
|
|
|
trans = trans[l]
|
|
|
|
break
|
|
|
|
end
|
2022-03-18 03:49:11 +00:00
|
|
|
end
|
|
|
|
next if trans.class != String
|
2023-05-20 15:25:00 +00:00
|
|
|
tmp_k = k
|
|
|
|
if !k.start_with?('default@')
|
|
|
|
prefix = is_cat_record ? "custom@#{cat.id}@" : 'default@'
|
|
|
|
tmp_k = "#{prefix}#{k}"
|
|
|
|
end
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields_infos[tmp_k] = {"trans"=>trans,"sort_number"=>sort_number[tmp_k],"key"=>k,"type"=>v["type"],"options"=>v["options"],"instructions"=>v["instructions"]}
|
2022-03-18 03:49:11 +00:00
|
|
|
end
|
2022-03-26 04:33:49 +00:00
|
|
|
ask_category_settings = []
|
2023-02-07 11:44:05 +00:00
|
|
|
if is_cat_record
|
2022-03-26 04:33:49 +00:00
|
|
|
ask_category_settings = []
|
|
|
|
else
|
2022-07-07 08:54:09 +00:00
|
|
|
ask_category_settings = AskCategorySetting.enabled.to_a
|
2022-03-26 04:33:49 +00:00
|
|
|
end
|
|
|
|
ask_category_settings.each do |c|
|
2023-05-20 15:25:00 +00:00
|
|
|
category = Category.find(c.category_id) rescue nil
|
|
|
|
if category.nil?
|
2022-09-08 03:24:20 +00:00
|
|
|
c.destroy
|
|
|
|
next
|
|
|
|
end
|
2022-03-18 03:49:11 +00:00
|
|
|
c.custom_fields.each do |k,v|
|
|
|
|
trans = v["field"]
|
|
|
|
tmp_locales.each do |l|
|
2022-08-18 03:07:45 +00:00
|
|
|
if trans[l].present?
|
|
|
|
trans = trans[l]
|
|
|
|
break
|
|
|
|
end
|
2022-03-18 03:49:11 +00:00
|
|
|
end
|
|
|
|
next if trans.class != String
|
2022-08-18 03:07:45 +00:00
|
|
|
next if k.start_with?('default@')
|
2022-03-18 03:49:11 +00:00
|
|
|
tmp_k = "custom@#{c.id}@#{k}"
|
2023-05-20 15:25:00 +00:00
|
|
|
cat_title = category.title rescue ""
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields_infos[tmp_k] = {"trans"=>"#{cat_title}-#{trans}","sort_number"=>sort_number[tmp_k],"key"=>k,"type"=>v["type"],"options"=>v["options"],"instructions"=>v["instructions"]}
|
2022-03-18 03:49:11 +00:00
|
|
|
end
|
|
|
|
end
|
2022-07-07 08:54:09 +00:00
|
|
|
tmp = disp_fields[-4..-1]
|
|
|
|
if only_display
|
|
|
|
tmp = tmp.select{|f| ask_setting.default_setting[f] || f == 'usage_rule'}
|
|
|
|
end
|
|
|
|
tmp.each do |f|
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields_infos[f] = {"trans"=>default_ask_setting.field_name(f,locale),"sort_number"=>sort_number[f]}
|
2022-03-18 03:49:11 +00:00
|
|
|
end
|
2022-07-07 08:54:09 +00:00
|
|
|
max_sort_number = disp_fields_infos.values.map{|h| h["sort_number"]}.compact.max
|
2022-03-18 03:49:11 +00:00
|
|
|
if max_sort_number
|
2023-02-10 05:34:07 +00:00
|
|
|
if !use_cache || (is_default_setting && override_sort_number.nil?)
|
2023-02-07 11:44:05 +00:00
|
|
|
max_sort_number = max_sort_number + 1
|
|
|
|
disp_fields_infos.each_with_index do |(k,h), i|
|
|
|
|
if h["sort_number"].blank?
|
|
|
|
h["sort_number"] = max_sort_number + i
|
|
|
|
end
|
2022-03-18 03:49:11 +00:00
|
|
|
end
|
|
|
|
end
|
2023-02-07 11:44:05 +00:00
|
|
|
disp_fields_infos = disp_fields_infos.sort_by {|_key, value| value["sort_number"]}.to_h
|
2022-03-18 03:49:11 +00:00
|
|
|
end
|
|
|
|
disp_fields_infos
|
|
|
|
end
|
2022-08-18 03:07:45 +00:00
|
|
|
def get_email_regex(frontend=false)
|
|
|
|
tmp = self.email_regex
|
2023-05-20 15:25:00 +00:00
|
|
|
if tmp && frontend
|
2022-08-18 03:07:45 +00:00
|
|
|
tmp = tmp.gsub("\\A","^").gsub("\\z","$").gsub("\\","\\\\\\\\")
|
|
|
|
end
|
2023-05-20 15:25:00 +00:00
|
|
|
tmp = nil if !(self.email_regex_enable) || ((self.default_setting[:mail] == false) rescue false)
|
2022-08-18 03:07:45 +00:00
|
|
|
tmp
|
|
|
|
end
|
2020-03-21 15:36:33 +00:00
|
|
|
end
|