c239452b47
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.
28 lines
848 B
Ruby
28 lines
848 B
Ruby
# 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)
|
|
if user_synced_attributes_metadata.provider
|
|
Gitlab::Auth::OAuth::Provider.label_for(user_synced_attributes_metadata.provider)
|
|
else
|
|
'LDAP'
|
|
end
|
|
end
|
|
end
|
|
end
|