diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index e11166a..773fabb 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,19 +1,19 @@ class UserMailer < ActionMailer::Base default from: I18n.t('helpers.main_email.from') - def sharing_notification(project_group) - @project_group = project_group - mail(to: @project_group.user.email, subject: I18n.t('helpers.main_email.access_given')) + def sharing_notification(role) + @role = role + mail(to: @role.user.email, subject: I18n.t('helpers.main_email.access_given')) end - def permissions_change_notification(project_group) - @project_group = project_group - mail(to: @project_group.user.email, subject: I18n.t('helpers.main_email.permission_changed')) + def permissions_change_notification(role) + @role = role + mail(to: @role.user.email, subject: I18n.t('helpers.main_email.permission_changed')) end - def project_access_removed_notification(user, project) + def project_access_removed_notification(user, plan) @user = user - @project = project + @plan = plan mail(to: @user.email, subject: I18n.t('helpers.main_email.access_removed')) end diff --git a/app/views/user_mailer/permissions_change_notification.html.erb b/app/views/user_mailer/permissions_change_notification.html.erb index 68bfe57..e7ed65e 100644 --- a/app/views/user_mailer/permissions_change_notification.html.erb +++ b/app/views/user_mailer/permissions_change_notification.html.erb @@ -1,12 +1,12 @@ -

<%= _('Hello') %> <%= @project_group.user.name %>

+

<%= _('Hello') %> <%= @role.user.name %>

<% access_level = "read-only" -if @project_group.access_level == 2 then +if @role.editor? access_level = "editor" -elsif @project_group.access_level == 3 then +elsif @project_group.administrator? access_level = "co-owner" end %> -

<%= ('Your permissions relating to') %>"<%= link_to @project_group.project.title, url_for(action: 'show', controller: 'projects', id: @project_group.project.id, locale: I18n.default_locale) %>"<%= _(' have changed. You now have') %><%= access_level %> <%= _('access.') %>

+

<%= ('Your permissions relating to') %>"<%= link_to @role.plan.title, url_for(action: 'show', controller: 'projects', id: @role.plan.id, locale: I18n.default_locale) %>"<%= _(' have changed. You now have') %><%= access_level %> <%= _('access.') %>

diff --git a/app/views/user_mailer/project_access_removed_notification.html.erb b/app/views/user_mailer/project_access_removed_notification.html.erb index fb6978c..778d50b 100644 --- a/app/views/user_mailer/project_access_removed_notification.html.erb +++ b/app/views/user_mailer/project_access_removed_notification.html.erb @@ -1,3 +1,3 @@

<%= _('Hello') %><%= @user.name %>

-

<%= _('Your access to ') %>"<%= @project.title %>"<%= _(' has been removed.') %>

+

<%= _('Your access to ') %>"<%= @plan.title %>"<%= _(' has been removed.') %>

diff --git a/app/views/user_mailer/sharing_notification.html.erb b/app/views/user_mailer/sharing_notification.html.erb index c350ee3..cccfddf 100644 --- a/app/views/user_mailer/sharing_notification.html.erb +++ b/app/views/user_mailer/sharing_notification.html.erb @@ -1,13 +1,13 @@ -

<%= _('Hello') %> <%= @project_group.user.name %>

+

<%= _('Hello') %> <%= @role.user.name %>

-<% +<% access_level = "read-only" -if @project_group.access_level == 2 then +if @role.editor? access_level = "editor" -elsif @project_group.access_level == 3 then +elsif @role.administrator? access_level = "co-owner" end %> -

<%= _('You have been given ') %><%= access_level %><%= _(' access to') %><%= link_to @project_group.project.title, url_for(action: 'show', controller: 'projects', id: @project_group.project.id, locale: I18n.default_locale) %>".

+

<%= _('You have been given ') %><%= access_level %><%= _(' access to') %><%= link_to @role.plan.title, url_for(action: 'show', controller: 'plans', id: @role.plan.id, locale: I18n.default_locale) %>".