Commit f76b3106 authored by Stan Hu's avatar Stan Hu

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
parents e9d6651f 78c8a3e3
...@@ -7,7 +7,7 @@ module ProfilesHelper ...@@ -7,7 +7,7 @@ module ProfilesHelper
[ [
[s_("Profiles|Use a private email - %{email}").html_safe % { email: private_email }, Gitlab::PrivateCommitEmail::TOKEN], [s_("Profiles|Use a private email - %{email}").html_safe % { email: private_email }, Gitlab::PrivateCommitEmail::TOKEN],
verified_emails *verified_emails
] ]
end end
......
---
title: Fix bug causing not all emails to show up in commit email selectbox
merge_request:
author:
type: fixed
...@@ -4,12 +4,17 @@ describe ProfilesHelper do ...@@ -4,12 +4,17 @@ describe ProfilesHelper do
describe '#commit_email_select_options' do describe '#commit_email_select_options' do
it 'returns an array with private commit email along with all the verified emails' do it 'returns an array with private commit email along with all the verified emails' do
user = create(:user) 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 private_email = user.private_commit_email
verified_emails = user.verified_emails - [private_email]
emails = [ emails = [
["Use a private email - #{private_email}", Gitlab::PrivateCommitEmail::TOKEN], ["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) expect(helper.commit_email_select_options(user)).to match_array(emails)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment