diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 00:10:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-20 00:10:13 +0000 |
commit | 82cd20acf9f4cceecf222abe718a9e23cef55687 (patch) | |
tree | 4587ee980cd01ceaeeeaa4ad3de5d94a1d9166e8 /app | |
parent | a7d1db72c912ef512c25724392f1c903e8d3bd7e (diff) | |
download | gitlab-ce-82cd20acf9f4cceecf222abe718a9e23cef55687.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/models/user.rb | 8 | ||||
-rw-r--r-- | app/views/profiles/_email_settings.html.haml | 2 | ||||
-rw-r--r-- | app/views/profiles/notifications/_email_settings.html.haml | 2 | ||||
-rw-r--r-- | app/views/profiles/notifications/_group_settings.html.haml | 2 |
4 files changed, 9 insertions, 5 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index ec9bc7ae01e..2c577fc9696 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1186,14 +1186,18 @@ class User < ApplicationRecord Member.where(invite_email: verified_emails).invite end - def all_emails + def all_emails(include_private_email: true) all_emails = [] all_emails << email unless temp_oauth_email? - all_emails << private_commit_email + all_emails << private_commit_email if include_private_email all_emails.concat(emails.map(&:email)) all_emails end + def all_public_emails + all_emails(include_private_email: false) + end + def verified_emails verified_emails = [] verified_emails << email if primary_email_verified? diff --git a/app/views/profiles/_email_settings.html.haml b/app/views/profiles/_email_settings.html.haml index fb4da08e129..beda6f05f88 100644 --- a/app/views/profiles/_email_settings.html.haml +++ b/app/views/profiles/_email_settings.html.haml @@ -5,7 +5,7 @@ - help_text = email_change_disabled ? s_("Your account uses dedicated credentials for the \"%{group_name}\" group and can only be updated through SSO.") % { group_name: @user.managing_group.name } : read_only_help_text = form.text_field :email, required: true, class: 'input-lg', value: (@user.email unless @user.temp_oauth_email?), help: help_text.html_safe, readonly: readonly || email_change_disabled -= form.select :public_email, options_for_select(@user.all_emails, selected: @user.public_email), += form.select :public_email, options_for_select(@user.all_public_emails, selected: @user.public_email), { help: s_("Profiles|This email will be displayed on your public profile"), include_blank: s_("Profiles|Do not show on profile") }, control_class: 'select2 input-lg', disabled: email_change_disabled - commit_email_link_url = help_page_path('user/profile/index', anchor: 'commit-email', target: '_blank') diff --git a/app/views/profiles/notifications/_email_settings.html.haml b/app/views/profiles/notifications/_email_settings.html.haml index 34dcf8f5402..d2c62d3d006 100644 --- a/app/views/profiles/notifications/_email_settings.html.haml +++ b/app/views/profiles/notifications/_email_settings.html.haml @@ -1,6 +1,6 @@ - form = local_assigns.fetch(:form) .form-group = form.label :notification_email, class: "label-bold" - = form.select :notification_email, @user.all_emails, { include_blank: false }, class: "select2", disabled: local_assigns.fetch(:email_change_disabled, nil) + = form.select :notification_email, @user.all_public_emails, { include_blank: false }, class: "select2", disabled: local_assigns.fetch(:email_change_disabled, nil) .help-block = local_assigns.fetch(:help_text, nil) diff --git a/app/views/profiles/notifications/_group_settings.html.haml b/app/views/profiles/notifications/_group_settings.html.haml index 33b0aa93d84..5be086948e7 100644 --- a/app/views/profiles/notifications/_group_settings.html.haml +++ b/app/views/profiles/notifications/_group_settings.html.haml @@ -13,4 +13,4 @@ .table-section.section-30 = form_for setting, url: profile_notifications_group_path(group), method: :put, html: { class: 'update-notifications' } do |f| - = f.select :notification_email, @user.all_emails, { include_blank: 'Global notification email' }, class: 'select2 js-group-notification-email' + = f.select :notification_email, @user.all_public_emails, { include_blank: 'Global notification email' }, class: 'select2 js-group-notification-email' |