Module: Namespaces::AdjournedDeletable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/namespaces/adjourned_deletable.rb
Instance Method Summary collapse
- #deletion_adjourned_period ⇒ Object
-
#deletion_in_progress_or_scheduled_in_hierarchy_chain? ⇒ Boolean
Returns true if the record or any of its ancestors is being deleted or scheduled for deletion.
-
#first_scheduled_for_deletion_in_hierarchy_chain ⇒ Object
Returns the first record that’s scheduled for deletion in self’s ancestors chain (including itself).
-
#scheduled_for_deletion_in_hierarchy_chain? ⇒ Boolean
Returns true if the record or any of its ancestors is scheduled for deletion.
-
#self_deletion_in_progress? ⇒ Boolean
Models need to define this method, usually based on the value of a database attribute.
-
#self_deletion_scheduled? ⇒ Boolean
Returns true if the record is scheduled for deletion.
-
#self_deletion_scheduled_deletion_created_on ⇒ Object
Returns the date when the scheduled deletion was created.
Instance Method Details
#deletion_adjourned_period ⇒ Object
51 52 53 |
# File 'app/models/concerns/namespaces/adjourned_deletable.rb', line 51 def deletion_adjourned_period ::Gitlab::CurrentSettings.deletion_adjourned_period end |
#deletion_in_progress_or_scheduled_in_hierarchy_chain? ⇒ Boolean
Returns true if the record or any of its ancestors is being deleted or scheduled for deletion.
47 48 49 |
# File 'app/models/concerns/namespaces/adjourned_deletable.rb', line 47 def deletion_in_progress_or_scheduled_in_hierarchy_chain? self_deletion_in_progress? || scheduled_for_deletion_in_hierarchy_chain? end |
#first_scheduled_for_deletion_in_hierarchy_chain ⇒ Object
Returns the first record that’s scheduled for deletion in self’s ancestors chain (including itself).
35 36 37 38 39 |
# File 'app/models/concerns/namespaces/adjourned_deletable.rb', line 35 def first_scheduled_for_deletion_in_hierarchy_chain return self if self_deletion_scheduled? all_scheduled_for_deletion_in_hierarchy_chain.first end |
#scheduled_for_deletion_in_hierarchy_chain? ⇒ Boolean
Returns true if the record or any of its ancestors is scheduled for deletion.
42 43 44 |
# File 'app/models/concerns/namespaces/adjourned_deletable.rb', line 42 def scheduled_for_deletion_in_hierarchy_chain? first_scheduled_for_deletion_in_hierarchy_chain.present? end |
#self_deletion_in_progress? ⇒ Boolean
Models need to define this method, usually based on the value of a database attribute
13 14 15 |
# File 'app/models/concerns/namespaces/adjourned_deletable.rb', line 13 def self_deletion_in_progress? raise NotImplementedError end |
#self_deletion_scheduled? ⇒ Boolean
Returns true if the record is scheduled for deletion.
30 31 32 |
# File 'app/models/concerns/namespaces/adjourned_deletable.rb', line 30 def self_deletion_scheduled? self_deletion_scheduled_deletion_created_on.present? end |
#self_deletion_scheduled_deletion_created_on ⇒ Object
Returns the date when the scheduled deletion was created.
25 26 27 |
# File 'app/models/concerns/namespaces/adjourned_deletable.rb', line 25 def self_deletion_scheduled_deletion_created_on marked_for_deletion_on if respond_to?(:marked_for_deletion_on) end |