diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index c9e4e198f..e773b9eee 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -60,6 +60,12 @@ module UsersHelper
end
end
+ def user_emails(user)
+ emails = [user.mail]
+ emails += user.email_addresses.order(:id).where(:is_default => false).pluck(:address)
+ emails.map {|email| mail_to(email, nil)}.join(', ').html_safe
+ end
+
def user_settings_tabs
tabs = [{:name => 'general', :partial => 'users/general', :label => :label_general},
{:name => 'memberships', :partial => 'users/memberships', :label => :label_project_plural}
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index e97119bab..fabf91dae 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -9,7 +9,7 @@
- <%=l(:field_login)%>: <%= @user.login %>
<% unless @user.pref.hide_mail %>
- - <%=l(:field_mail)%>: <%= mail_to(@user.mail, nil, :encode => 'javascript') %>
+ - <%=l(:field_mail)%>: <%= user_emails(@user) %>
<% end %>
<% @user.visible_custom_field_values.each do |custom_value| %>
<% if !custom_value.value.blank? %>
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 35a1e82d7..0362d1fc8 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -255,6 +255,20 @@ class UsersControllerTest < Redmine::ControllerTest
end
end
+ def test_show_should_list_all_emails
+ EmailAddress.create!(user_id: 3, address: 'dlopper@example.net')
+ EmailAddress.create!(user_id: 3, address: 'dlopper@example.org')
+
+ @request.session[:user_id] = 1
+ get :show, params: {id: 3}
+
+ assert_select 'li', text: /Email:/ do
+ assert_select 'a:nth-of-type(1)', text: 'dlopper@somenet.foo'
+ assert_select 'a:nth-of-type(2)', text: 'dlopper@example.net'
+ assert_select 'a:nth-of-type(3)', text: 'dlopper@example.org'
+ end
+ end
+
def test_new
get :new
assert_response :success