diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index ba4ca5b..1a88646 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -17,7 +17,7 @@ FastGettext.with_locale FastGettext.default_locale do mail(to: @role.user.email, subject: d_('dmpopidor', '%{user_name} has shared a Data Management Plan with you in %{tool_name}') %{ - :user_name => @user.invited_by.name(false), + :user_name => @user.invited_by ? @user.invited_by.name(false) : "A collegue", :tool_name => Rails.configuration.branding[:application][:name] }) end diff --git a/app/views/user_mailer/permissions_change_notification.html.erb b/app/views/user_mailer/permissions_change_notification.html.erb index d9553fe..6ad1d29 100644 --- a/app/views/user_mailer/permissions_change_notification.html.erb +++ b/app/views/user_mailer/permissions_change_notification.html.erb @@ -1,6 +1,6 @@ <% tool_name = Rails.configuration.branding[:application][:name] - username = @user.name + username = @role.user.name(false) plan_title = @role.plan.title access = nil access_level = @role.access_level() diff --git a/app/views/user_mailer/plan_access_removed.html.erb b/app/views/user_mailer/plan_access_removed.html.erb index dbb963c..09836be 100644 --- a/app/views/user_mailer/plan_access_removed.html.erb +++ b/app/views/user_mailer/plan_access_removed.html.erb @@ -1,5 +1,5 @@ <% FastGettext.with_locale FastGettext.default_locale do %> -
<%= _('Hello ') %><%= @user.email %>,
+<%= _('Hello ') %><%= @user.name(false) %>,
<%= _('Your access to ') %>"<%= @plan.title %>"<%= _(' has been removed by ') %><%= "#{@current_user.name(false)}"%>.
<%= render partial: 'email_signature' %> <% end %> diff --git a/app/views/user_mailer/sharing_notification.html.erb b/app/views/user_mailer/sharing_notification.html.erb index 996df91..fe1667b 100644 --- a/app/views/user_mailer/sharing_notification.html.erb +++ b/app/views/user_mailer/sharing_notification.html.erb @@ -1,7 +1,7 @@ <% tool_name = Rails.configuration.branding[:application][:name] - sender_name = @user.invited_by.name(false) - user_email = @user.email + sender_name = @user.invited_by ? @user.invited_by.name(false) : "A collegue" + user_email = @user.name(false) link = url_for(action: 'show', controller: 'plans', id: @role.plan.id) %> <% FastGettext.with_locale FastGettext.default_locale do %>