diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 00:09:12 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 00:09:12 +0000 |
commit | 6168721025dd8e98caeb2bf6844273e6690eaf69 (patch) | |
tree | 8c4fb20d793669e488a739bc9951dab8b363eed4 /app/models/user.rb | |
parent | a89cb5cbdd832d4d9e80517973aceda6bc0a3856 (diff) | |
download | gitlab-ce-6168721025dd8e98caeb2bf6844273e6690eaf69.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index aa7e825d516..11bfa485ae9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -190,6 +190,12 @@ class User < ApplicationRecord validate :owns_commit_email, if: :commit_email_changed? validate :signup_domain_valid?, on: :create, if: ->(user) { !user.created_by_id } + validates :theme_id, allow_nil: true, inclusion: { in: Gitlab::Themes.valid_ids, + message: _("%{placeholder} is not a valid theme") % { placeholder: '%{value}' } } + + validates :color_scheme_id, allow_nil: true, inclusion: { in: Gitlab::ColorSchemes.valid_ids, + message: _("%{placeholder} is not a valid color scheme") % { placeholder: '%{value}' } } + before_validation :sanitize_attrs before_validation :set_notification_email, if: :new_record? before_validation :set_public_email, if: :public_email_changed? |