diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-11-07 11:00:21 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-11-07 12:24:14 +0000 |
commit | c239452b47f2819e3ed2fdaf4679737b3e1a456e (patch) | |
tree | bfaee22cd6c0f180faa2a9f83a97375efd804fff /app/models/application_setting.rb | |
parent | c81d4a65a255146619ccf52ece16757c7db622ae (diff) | |
download | gitlab-ce-c239452b47f2819e3ed2fdaf4679737b3e1a456e.tar.gz |
User can keep their commit email private43521-keep-personal-emails-private
The private commit email is automatically generated in the format:
id-username@noreply.HOSTNAME
GitLab instance admins are able to change the HOSTNAME portion,
that defaults to Gitlab's hostname, to whatever they prefer.
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r-- | app/models/application_setting.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 704310f53f0..207ffae873a 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -187,6 +187,8 @@ class ApplicationSetting < ActiveRecord::Base validates :user_default_internal_regex, js_regex: true, allow_nil: true + validates :commit_email_hostname, format: { with: /\A[^@]+\z/ } + validates :archive_builds_in_seconds, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 1.day.seconds } @@ -299,10 +301,15 @@ class ApplicationSetting < ActiveRecord::Base user_default_internal_regex: nil, user_show_add_ssh_key_message: true, usage_stats_set_by_user_id: nil, - diff_max_patch_bytes: Gitlab::Git::Diff::DEFAULT_MAX_PATCH_BYTES + diff_max_patch_bytes: Gitlab::Git::Diff::DEFAULT_MAX_PATCH_BYTES, + commit_email_hostname: default_commit_email_hostname } end + def self.default_commit_email_hostname + "users.noreply.#{Gitlab.config.gitlab.host}" + end + def self.create_from_defaults create(defaults) end @@ -358,6 +365,10 @@ class ApplicationSetting < ActiveRecord::Base Array(read_attribute(:repository_storages)) end + def commit_email_hostname + super.presence || self.class.default_commit_email_hostname + end + def default_project_visibility=(level) super(Gitlab::VisibilityLevel.level_value(level)) end |