debian-mirror-gitlab/app/helpers/profiles_helper.rb

41 lines
1.1 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
module ProfilesHelper
2018-12-13 13:39:08 +05:30
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
2018-03-17 18:26:18 +05:30
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
2018-03-27 19:54:05 +05:30
Gitlab::Auth::OAuth::Provider.label_for(user_synced_attributes_metadata.provider)
2018-03-17 18:26:18 +05:30
else
'LDAP'
end
end
2017-09-10 17:25:29 +05:30
end
2019-03-02 22:35:43 +05:30
def user_profile?
params[:controller] == 'users'
end
2021-01-29 00:20:46 +05:30
def availability_values
Types::AvailabilityEnum.enum
end
def user_status_set_to_busy?(status)
status&.availability == availability_values[:busy]
end
2017-09-10 17:25:29 +05:30
end