Class: WorkItems::ParentLink
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- WorkItems::ParentLink
- Includes:
- RelativePositioning
- Defined in:
- app/models/work_items/parent_link.rb
Constant Summary collapse
- MAX_CHILDREN =
5000
Constants included from Gitlab::RelativePositioning
Gitlab::RelativePositioning::IDEAL_DISTANCE, Gitlab::RelativePositioning::IllegalRange, Gitlab::RelativePositioning::InvalidPosition, Gitlab::RelativePositioning::IssuePositioningDisabled, Gitlab::RelativePositioning::MAX_GAP, Gitlab::RelativePositioning::MAX_POSITION, Gitlab::RelativePositioning::MIN_GAP, Gitlab::RelativePositioning::MIN_POSITION, Gitlab::RelativePositioning::NoSpaceLeft, Gitlab::RelativePositioning::START_POSITION, Gitlab::RelativePositioning::STEPS
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Class Method Summary collapse
- .for_work_item(work_item) ⇒ Object
- .has_confidential_parent?(id) ⇒ Boolean
- .has_public_children?(parent_id) ⇒ Boolean
- .relative_positioning_parent_column ⇒ Object
- .relative_positioning_query_base(parent_link) ⇒ Object
Methods included from RelativePositioning
#check_repositioning_allowed!, #could_not_move, #exclude_self, #model_class, #move_after, #move_before, #move_between, #move_to_end, #move_to_start, mover, #next_object_by_relative_position, #relative_positioning_scoped_items, #reset_relative_position, #update_relative_siblings
Methods included from Gitlab::RelativePositioning
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, nullable_column?, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Class Method Details
.for_work_item(work_item) ⇒ Object
45 46 47 |
# File 'app/models/work_items/parent_link.rb', line 45 def for_work_item(work_item) find_or_initialize_by(work_item: work_item) end |
.has_confidential_parent?(id) ⇒ Boolean
30 31 32 33 34 35 |
# File 'app/models/work_items/parent_link.rb', line 30 def has_confidential_parent?(id) link = find_by_work_item_id(id) return false unless link link.work_item_parent.confidential? end |
.has_public_children?(parent_id) ⇒ Boolean
26 27 28 |
# File 'app/models/work_items/parent_link.rb', line 26 def has_public_children?(parent_id) joins(:work_item).where(work_item_parent_id: parent_id, 'issues.confidential': false).exists? end |
.relative_positioning_parent_column ⇒ Object
41 42 43 |
# File 'app/models/work_items/parent_link.rb', line 41 def relative_positioning_parent_column :work_item_parent_id end |
.relative_positioning_query_base(parent_link) ⇒ Object
37 38 39 |
# File 'app/models/work_items/parent_link.rb', line 37 def relative_positioning_query_base(parent_link) where(work_item_parent_id: parent_link.work_item_parent_id) end |