Defect #33601

Additional email addresses are not displayed in user profile page

Added by Go MAEDA 21 days ago. Updated 11 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Accounts / authentication
Target version:4.2.0
Resolution:Fixed Affected version:

Description

Redmine 3.0.0 or later supports multiple email addresses per user (#4244), but only the default email address is displayed on the user profile page. Additional email addresses must be displayed there as well.

user-profile.png (27.1 KB) Go MAEDA, 2020-06-16 10:10

33601.patch Magnifier (2.08 KB) Go MAEDA, 2020-06-22 16:15

Associated revisions

Revision 19836
Added by Go MAEDA 11 days ago

Additional email addresses are not displayed in user profile page (#33601).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA 21 days ago

The following code fixes the issue.

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 @@
 <ul>
   <li><%=l(:field_login)%>: <%= @user.login %></li>
   <% unless @user.pref.hide_mail %>
-    <li><%=l(:field_mail)%>: <%= mail_to(@user.mail, nil, :encode => 'javascript') %></li>
+    <li><%=l(:field_mail)%>: <%= user_emails(@user) %></li>
   <% end %>
   <% @user.visible_custom_field_values.each do |custom_value| %>
   <% if !custom_value.value.blank? %>

#2 Updated by Go MAEDA 15 days ago

  • File 33601.patchMagnifier added
  • Target version set to Candidate for next major release

Attaching a patch.

#3 Updated by Go MAEDA 14 days ago

  • Target version changed from Candidate for next major release to 4.2.0

Setting the target version to 4.2.0.

#4 Updated by Go MAEDA 11 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch.

Also available in: Atom PDF