mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Fix status check in model #2845
This commit is contained in:
parent
ac977d2b8c
commit
c5ba1b0dd3
2 changed files with 9 additions and 1 deletions
7
app/models/concerns/statuses.rb
Normal file
7
app/models/concerns/statuses.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
module Statuses
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def force_delete?
|
||||
statuses.include?(DomainStatus::FORCE_DELETE)
|
||||
end
|
||||
end
|
|
@ -1,6 +1,7 @@
|
|||
# rubocop: disable Metrics/ClassLength
|
||||
class Domain < ActiveRecord::Base
|
||||
include Versions # version/domain_version.rb
|
||||
include Statuses
|
||||
has_paper_trail class_name: "DomainVersion", meta: { children: :children_log }
|
||||
|
||||
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
|
||||
|
@ -107,7 +108,7 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
validate :check_permissions
|
||||
def check_permissions
|
||||
return unless update_prohibited? || delete_prohibited?
|
||||
return unless force_delete?
|
||||
errors.add(:base, I18n.t(:object_status_prohibits_operation))
|
||||
false
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue