From 727d36003dd52bdb5eaabbddec766ebfe1edef6e Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 14 Nov 2018 19:50:21 +0000 Subject: Merge branch 'dm-commit-email-select-options' into 'master' Fix bug causing not all emails to show up in commit email selectbox Closes #54045 See merge request gitlab-org/gitlab-ce!23079 --- app/helpers/profiles_helper.rb | 2 +- changelogs/unreleased/dm-commit-email-select-options.yml | 5 +++++ spec/helpers/profiles_helper_spec.rb | 9 +++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/dm-commit-email-select-options.yml diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb index 42f9a1213e9..df318de740a 100644 --- a/app/helpers/profiles_helper.rb +++ b/app/helpers/profiles_helper.rb @@ -7,7 +7,7 @@ module ProfilesHelper [ [s_("Profiles|Use a private email - %{email}").html_safe % { email: private_email }, Gitlab::PrivateCommitEmail::TOKEN], - verified_emails + *verified_emails ] end diff --git a/changelogs/unreleased/dm-commit-email-select-options.yml b/changelogs/unreleased/dm-commit-email-select-options.yml new file mode 100644 index 00000000000..90d5c8cf0c6 --- /dev/null +++ b/changelogs/unreleased/dm-commit-email-select-options.yml @@ -0,0 +1,5 @@ +--- +title: Fix bug causing not all emails to show up in commit email selectbox +merge_request: +author: +type: fixed diff --git a/spec/helpers/profiles_helper_spec.rb b/spec/helpers/profiles_helper_spec.rb index 9a2372de69f..8e336469c27 100644 --- a/spec/helpers/profiles_helper_spec.rb +++ b/spec/helpers/profiles_helper_spec.rb @@ -4,12 +4,17 @@ describe ProfilesHelper do describe '#commit_email_select_options' do it 'returns an array with private commit email along with all the verified emails' do user = create(:user) + create(:email, user: user) + confirmed_email1 = create(:email, :confirmed, user: user) + confirmed_email2 = create(:email, :confirmed, user: user) + private_email = user.private_commit_email - verified_emails = user.verified_emails - [private_email] emails = [ ["Use a private email - #{private_email}", Gitlab::PrivateCommitEmail::TOKEN], - verified_emails + user.email, + confirmed_email1.email, + confirmed_email2.email ] expect(helper.commit_email_select_options(user)).to match_array(emails) -- cgit v1.2.1