summaryrefslogtreecommitdiff
path: root/app/helpers/profiles_helper.rb
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-11-07 11:00:21 +0000
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-11-07 12:24:14 +0000
commitc239452b47f2819e3ed2fdaf4679737b3e1a456e (patch)
treebfaee22cd6c0f180faa2a9f83a97375efd804fff /app/helpers/profiles_helper.rb
parentc81d4a65a255146619ccf52ece16757c7db622ae (diff)
downloadgitlab-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/helpers/profiles_helper.rb')
-rw-r--r--app/helpers/profiles_helper.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb
index 55674e37a34..42f9a1213e9 100644
--- a/app/helpers/profiles_helper.rb
+++ b/app/helpers/profiles_helper.rb
@@ -1,6 +1,20 @@
# frozen_string_literal: true
module ProfilesHelper
+ def commit_email_select_options(user)
+ private_email = user.private_commit_email
+ verified_emails = user.verified_emails - [private_email]
+
+ [
+ [s_("Profiles|Use a private email - %{email}").html_safe % { email: private_email }, Gitlab::PrivateCommitEmail::TOKEN],
+ verified_emails
+ ]
+ end
+
+ def selected_commit_email(user)
+ user.read_attribute(:commit_email) || user.commit_email
+ end
+
def attribute_provider_label(attribute)
user_synced_attributes_metadata = current_user.user_synced_attributes_metadata
if user_synced_attributes_metadata&.synced?(attribute)