Class: Board

Inherits:
ApplicationRecord show all
Includes:
EachBatch
Defined in:
app/models/board.rb

Constant Summary collapse

RECENT_BOARDS_SIZE =
4

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, 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 Organizations::Sharding

#sharding_organization

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Class Method Details

.to_typeObject



48
49
50
# File 'app/models/board.rb', line 48

def self.to_type
  name.demodulize
end

Instance Method Details

#disabled_for?(current_user) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
59
60
# File 'app/models/board.rb', line 56

def disabled_for?(current_user)
  namespace = group_board? ? resource_parent.root_ancestor : resource_parent.root_namespace

  namespace.issue_repositioning_disabled? || !Ability.allowed?(current_user, :create_non_backlog_issues, self)
end

#group_board?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/board.rb', line 36

def group_board?
  group_id.present?
end

#project_board?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/board.rb', line 40

def project_board?
  project_id.present?
end

#project_needed?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/models/board.rb', line 28

def project_needed?
  !group
end

#resource_parentObject



32
33
34
# File 'app/models/board.rb', line 32

def resource_parent
  @resource_parent ||= group || project
end

#scoped?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/models/board.rb', line 44

def scoped?
  false
end

#to_typeObject



52
53
54
# File 'app/models/board.rb', line 52

def to_type
  self.class.to_type
end