Class: ProjectSetting
Constant Summary
collapse
- ALLOWED_TARGET_PLATFORMS =
%w[ios osx tvos watchos android].freeze
ApplicationRecord::MAX_PLUCK
ResetOnUnionError::MAX_RESET_PERIOD
Instance Method Summary
collapse
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, 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
#serializable_hash
Instance Method Details
#emails_enabled? ⇒ Boolean
99
100
101
|
# File 'app/models/project_setting.rb', line 99
def emails_enabled?
super && project.namespace.emails_enabled?
end
|
#human_squash_option ⇒ Object
77
78
79
80
81
82
83
84
|
# File 'app/models/project_setting.rb', line 77
def human_squash_option
case squash_option
when 'never' then 'Do not allow'
when 'always' then 'Require'
when 'default_on' then 'Encourage'
when 'default_off' then 'Allow'
end
end
|
#runner_registration_enabled ⇒ Object
95
96
97
|
# File 'app/models/project_setting.rb', line 95
def runner_registration_enabled
Gitlab::CurrentSettings.valid_runner_registrars.include?('project') && read_attribute(:runner_registration_enabled)
end
|
#show_diff_preview_in_email? ⇒ Boolean
86
87
88
89
90
91
92
|
# File 'app/models/project_setting.rb', line 86
def show_diff_preview_in_email?
if project.group
super && project.group&.show_diff_preview_in_email?
else
!!super
end
end
|
#squash_enabled_by_default? ⇒ Boolean
65
66
67
|
# File 'app/models/project_setting.rb', line 65
def squash_enabled_by_default?
%w[always default_on].include?(squash_option)
end
|
#squash_readonly? ⇒ Boolean
69
70
71
|
# File 'app/models/project_setting.rb', line 69
def squash_readonly?
%w[always never].include?(squash_option)
end
|
73
74
75
|
# File 'app/models/project_setting.rb', line 73
def target_platforms=(val)
super(val&.map(&:to_s)&.sort)
end
|