diff options
Diffstat (limited to 'app/models/project_setting.rb')
-rw-r--r-- | app/models/project_setting.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/project_setting.rb b/app/models/project_setting.rb index db86bb5e1fb..379b94b3af5 100644 --- a/app/models/project_setting.rb +++ b/app/models/project_setting.rb @@ -25,6 +25,10 @@ class ProjectSetting < ApplicationRecord validates :target_platforms, inclusion: { in: ALLOWED_TARGET_PLATFORMS } validates :suggested_reviewers_enabled, inclusion: { in: [true, false] } + validates :pages_unique_domain, + uniqueness: { if: -> { pages_unique_domain.present? } }, + presence: { if: :require_unique_domain? } + validate :validates_mr_default_target_self attribute :legacy_open_source_license_available, default: -> do @@ -68,6 +72,11 @@ class ProjectSetting < ApplicationRecord errors.add :mr_default_target_self, _('This setting is allowed for forked projects only') end end + + def require_unique_domain? + pages_unique_domain_enabled || + pages_unique_domain_in_database.present? + end end ProjectSetting.prepend_mod |