Class: ProjectSetting
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ProjectSetting
- Includes:
- AfterCommitQueue, CascadingProjectSettingAttribute, EachBatch, Gitlab::EncryptedAttribute, Gitlab::Utils::StrongMemoize, Projects::SquashOption, SafelyChangeColumnDefault
- Defined in:
- app/models/project_setting.rb
Constant Summary collapse
- ALLOWED_TARGET_PLATFORMS =
%w[ios osx tvos watchos android].freeze
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
-
.unique_domain_exists?(domain) ⇒ Boolean
Checks if a given domain is already assigned to any existing project.
Instance Method Summary collapse
- #branch_rule ⇒ Object
- #emails_enabled? ⇒ Boolean
- #pages_primary_domain=(value) ⇒ Object
- #runner_registration_enabled ⇒ Object
- #show_diff_preview_in_email? ⇒ Boolean
- #target_platforms=(val) ⇒ Object
Methods included from AfterCommitQueue
#run_after_commit, #run_after_commit_or_now
Methods included from Projects::SquashOption
#human_squash_option, #squash_enabled_by_default?, #squash_readonly?
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
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Class Method Details
.unique_domain_exists?(domain) ⇒ Boolean
Checks if a given domain is already assigned to any existing project
70 71 72 |
# File 'app/models/project_setting.rb', line 70 def self.unique_domain_exists?(domain) where(pages_unique_domain: domain).exists? end |
Instance Method Details
#branch_rule ⇒ Object
100 101 102 |
# File 'app/models/project_setting.rb', line 100 def branch_rule ::Projects::AllBranchesRule.new(project) end |
#emails_enabled? ⇒ Boolean
91 92 93 |
# File 'app/models/project_setting.rb', line 91 def emails_enabled? super && project.namespace.emails_enabled? end |
#pages_primary_domain=(value) ⇒ Object
96 97 98 |
# File 'app/models/project_setting.rb', line 96 def pages_primary_domain=(value) super(value.presence) # Call the default setter to set the value end |
#runner_registration_enabled ⇒ Object
87 88 89 |
# File 'app/models/project_setting.rb', line 87 def runner_registration_enabled Gitlab::CurrentSettings.valid_runner_registrars.include?('project') && read_attribute(:runner_registration_enabled) end |
#show_diff_preview_in_email? ⇒ Boolean
78 79 80 81 82 83 84 |
# File 'app/models/project_setting.rb', line 78 def show_diff_preview_in_email? if project.group super && project.group&.show_diff_preview_in_email? else !!super end end |
#target_platforms=(val) ⇒ Object
74 75 76 |
# File 'app/models/project_setting.rb', line 74 def target_platforms=(val) super(val&.map(&:to_s)&.sort) end |