summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 00:09:12 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 00:09:12 +0000
commit6168721025dd8e98caeb2bf6844273e6690eaf69 (patch)
tree8c4fb20d793669e488a739bc9951dab8b363eed4 /app/models/user.rb
parenta89cb5cbdd832d4d9e80517973aceda6bc0a3856 (diff)
downloadgitlab-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.rb6
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?