mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Fix rubocop #2565
This commit is contained in:
parent
55b746a428
commit
bf2c0c6bb7
2 changed files with 0 additions and 13 deletions
|
@ -19,6 +19,5 @@ class Admin::BlockedDomainsController < AdminController
|
|||
flash.now[:alert] = I18n.t('failed_to_update_record')
|
||||
render :index
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
class DomainNameValidator < ActiveModel::EachValidator
|
||||
# rubocop: disable Metrics/PerceivedComplexity
|
||||
# rubocop: disable Metrics/CyclomaticComplexity
|
||||
def validate_each(record, attribute, value)
|
||||
if !self.class.validate_format(value)
|
||||
record.errors[attribute] << (options[:message] || record.errors.generate_message(attribute, :invalid))
|
||||
elsif !self.class.validate_blocked(value)
|
||||
record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :blocked)))
|
||||
# elsif !self.class.validate_reservation(value)
|
||||
# record.errors.add(attribute, (options[:message] || record.errors.generate_message(attribute, :reserved)))
|
||||
end
|
||||
end
|
||||
# rubocop: enable Metrics/PerceivedComplexity
|
||||
# rubocop: enable Metrics/CyclomaticComplexity
|
||||
|
||||
class << self
|
||||
def validate_format(value)
|
||||
|
@ -41,11 +35,5 @@ class DomainNameValidator < ActiveModel::EachValidator
|
|||
return true unless value
|
||||
BlockedDomain.where("names @> ?::varchar[]", "{#{value}}").count == 0
|
||||
end
|
||||
|
||||
# def validate_reservation(record, value)
|
||||
# return true unless value
|
||||
# return true if record.reserved_pw == record.auth_info
|
||||
# !ReservedDomain.exists?(name: value.mb_chars.downcase.strip)
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue