2020-02-10 07:08:59 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ProjectSetting < ApplicationRecord
|
2021-07-28 11:09:57 -04:00
|
|
|
include IgnorableColumns
|
|
|
|
|
|
|
|
ignore_column :allow_editing_commit_messages, remove_with: '14.4', remove_after: '2021-09-10'
|
|
|
|
|
2020-02-10 07:08:59 -05:00
|
|
|
belongs_to :project, inverse_of: :project_setting
|
|
|
|
|
2020-06-30 14:09:13 -04:00
|
|
|
enum squash_option: {
|
|
|
|
never: 0,
|
|
|
|
always: 1,
|
|
|
|
default_on: 2,
|
|
|
|
default_off: 3
|
|
|
|
}, _prefix: 'squash'
|
|
|
|
|
2020-02-10 07:08:59 -05:00
|
|
|
self.primary_key = :project_id
|
2020-06-30 14:09:13 -04:00
|
|
|
|
|
|
|
def squash_enabled_by_default?
|
|
|
|
%w[always default_on].include?(squash_option)
|
|
|
|
end
|
|
|
|
|
|
|
|
def squash_readonly?
|
|
|
|
%w[always never].include?(squash_option)
|
|
|
|
end
|
2020-02-10 07:08:59 -05:00
|
|
|
end
|
2020-04-15 14:09:36 -04:00
|
|
|
|
2021-05-11 17:10:21 -04:00
|
|
|
ProjectSetting.prepend_mod
|