summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-11-14 19:50:21 +0000
committerAlex Hanselka <alex@gitlab.com>2018-11-14 17:14:14 -0600
commit727d36003dd52bdb5eaabbddec766ebfe1edef6e (patch)
treea925fe6582de8c23a732c70cdc0960b8ad9af06a
parentc7faf88fbc4cfe1fc13f51ac9d0a38e1464a76ad (diff)
downloadgitlab-ce-727d36003dd52bdb5eaabbddec766ebfe1edef6e.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.rb2
-rw-r--r--changelogs/unreleased/dm-commit-email-select-options.yml5
-rw-r--r--spec/helpers/profiles_helper_spec.rb9
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)