summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2018-11-14 19:09:33 +0100
committerStan Hu <stanhu@gmail.com>2018-11-14 11:03:20 -0800
commit78c8a3e37d27383ef6d452ef4c6124d49cd99aa7 (patch)
treea7b7ad68730234d6415e853b08374f60084f98e2
parent5b1b093403f8a3108a5de6572fd503cef763ae81 (diff)
downloadgitlab-ce-78c8a3e37d27383ef6d452ef4c6124d49cd99aa7.tar.gz
Fix bug causing not all emails to show up in commit email selectbox
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54045
-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)