diff options
author | Stan Hu <stanhu@gmail.com> | 2018-11-14 19:50:21 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-11-14 19:50:21 +0000 |
commit | f76b3106e85411c3526b88ae366ef7619241cb85 (patch) | |
tree | cac8a51afa92e4e87f44240af940f7c6f3e7ac58 | |
parent | e9d6651f42507d87aeb84a17fc6c0b6298bce856 (diff) | |
parent | 78c8a3e37d27383ef6d452ef4c6124d49cd99aa7 (diff) | |
download | gitlab-ce-f76b3106e85411c3526b88ae366ef7619241cb85.tar.gz |
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
-rw-r--r-- | app/helpers/profiles_helper.rb | 2 | ||||
-rw-r--r-- | changelogs/unreleased/dm-commit-email-select-options.yml | 5 | ||||
-rw-r--r-- | spec/helpers/profiles_helper_spec.rb | 9 |
3 files changed, 13 insertions, 3 deletions
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) |