1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

handle deleted users in notifications

This commit is contained in:
Sylvain 2019-06-12 15:49:35 +02:00
parent ddce997e12
commit d0cd5a90d2
32 changed files with 36 additions and 32 deletions

View File

@ -5,5 +5,5 @@
json.title notification.notification_type
json.description _t('.invoices_generation_was_STATUS_for_user_NAME_html',
STATUS: notification.attached_object.invoicing_disabled.to_s,
NAME: notification.attached_object.profile.full_name) # messageFormat
NAME: notification.attached_object&.profile&.full_name || t('api.notifications.deleted_user')) # messageFormat
json.url notification_url(notification, format: :json)

View File

@ -1,5 +1,5 @@
json.title notification.notification_type
json.description t('.a_RESERVABLE_reservation_was_made_by_USER_html',
RESERVABLE: notification.attached_object.reservable.name,
USER: notification.attached_object.user&.profile&.full_name)
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
json.url notification_url(notification, format: :json)

View File

@ -1,5 +1,5 @@
json.title notification.notification_type
json.description t('.USER_s_reservation_on_the_DATE_was_cancelled_remember_to_generate_a_refund_invoice_if_applicable_html',
USER: notification.attached_object.reservation.user&.profile&.full_name,
USER: notification.attached_object.reservation.user&.profile&.full_name || t('api.notifications.deleted_user'),
DATE: I18n.l(notification.attached_object.start_at, format: :long))
json.url notification_url(notification, format: :json)

View File

@ -1,5 +1,5 @@
json.title notification.notification_type
json.description t('.subscription_PLAN_has_been_subscribed_by_USER_html',
PLAN: notification.attached_object.plan.name,
USER: notification.attached_object.user&.profile&.full_name)
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
json.url notification_url(notification, format: :json)

View File

@ -1,4 +1,4 @@
json.title notification.notification_type
json.description t('.USER_s_subscription_has_been_cancelled',
USER: notification.attached_object.user&.profile&.full_name)
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
json.url notification_url(notification, format: :json)

View File

@ -2,7 +2,7 @@ json.title notification.notification_type
json.description _t('.subscription_PLAN_of_the_member_USER_has_been_extended_FREE_until_DATE_html',
{
PLAN: notification.attached_object.plan.name,
USER: notification.attached_object.user&.profile&.full_name,
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'),
FREE: notification.get_meta_data(:free_days).to_s,
DATE: I18n.l(notification.attached_object.expired_at.to_date)
}) # messageFormat

View File

@ -1,4 +1,4 @@
json.title notification.notification_type
json.description t('.USER_s_subscription_has_expired',
USER:notification.attached_object.user&.profile&.full_name)
USER:notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
json.url notification_url(notification, format: :json)

View File

@ -1,4 +1,4 @@
json.title notification.notification_type
json.description t('.USER_s_subscription_will_expire_in_7_days',
USER: notification.attached_object.user&.profile&.full_name)
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
json.url notification_url(notification, format: :json)

View File

@ -1,7 +1,7 @@
json.title notification.notification_type
json.description _t('.user_NAME_changed_his_group_html',
{
NAME: notification.attached_object&.profile&.full_name,
NAME: notification.attached_object&.profile&.full_name || t('api.notifications.deleted_user'),
GENDER: bool_to_sym(notification.attached_object&.statistic_profile&.gender)
}) # messageFormat
json.url notification_url(notification, format: :json)

View File

@ -1,7 +1,7 @@
json.title notification.notification_type
json.description _t('.user_NAME_has_merged_his_account_with_the_one_imported_from_PROVIDER_UID_html',
{
NAME: notification.attached_object&.profile&.full_name,
NAME: notification.attached_object&.profile&.full_name || t('api.notifications.deleted_user'),
GENDER: bool_to_sym(notification.attached_object&.statistic_profile&.gender),
PROVIDER: notification.attached_object&.provider,
UID: notification.attached_object&.uid

View File

@ -2,6 +2,6 @@ json.title notification.notification_type
amount = notification.attached_object.amount
json.description t('.wallet_is_credited',
AMOUNT: number_to_currency(amount),
USER: notification.attached_object.wallet.user&.profile&.full_name,
ADMIN: notification.attached_object.user&.profile&.full_name)
USER: notification.attached_object.wallet.user&.profile&.full_name || t('api.notifications.deleted_user'),
ADMIN: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
json.url notification_url(notification, format: :json)

View File

@ -1,5 +1,5 @@
json.title notification.notification_type
json.description t('.a_new_user_account_has_been_created_NAME_EMAIL_html',
NAME: notification.attached_object&.profile&.full_name,
NAME: notification.attached_object&.profile&.full_name || t('api.notifications.deleted_user'),
EMAIL: notification.attached_object&.email)
json.url notification_url(notification, format: :json)

View File

@ -2,6 +2,6 @@ json.title notification.notification_type
json.description t('.subscription_partner_PLAN_has_been_subscribed_by_USER_html',
{
PLAN: notification.attached_object.plan.name,
USER: notification.attached_object.user&.profile&.full_name
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user')
}) # messageFormat
json.url notification_url(notification, format: :json)

View File

@ -1,5 +1,5 @@
json.title notification.notification_type
json.description t('.USER_became_collaborator_of_your_project',
USER: notification.attached_object.user&.profile&.full_name) +
USER: notification.attached_object.user&.profile&.full_name || t('api.notifications.deleted_user')) +
"<a href='/#!/projects/#{notification.attached_object.project.slug}'><strong><em> #{notification.attached_object.project.name}</em></strong></a>."
json.url notification_url(notification, format: :json)

View File

@ -2,7 +2,7 @@
<p>
<%= t('.body.member_reserved_html',
NAME: @attached_object.user.profile.full_name,
NAME: @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'),
RESERVABLE: @attached_object.reservable.name) %>
</p>
<p><%= t('.body.reserved_slots') %></p>

View File

@ -3,12 +3,12 @@
<% if provider.name == AuthProvider::SimpleAuthProvider.new.name %>
<p><%= t('.body.account_completed') %>
<%= "#{@attached_object.profile.full_name}" %> &lt;<%= @attached_object.email%>&gt;.</p>
<%= "#{@attached_object&.profile&.full_name || t('api.notifications.deleted_user')}" %> &lt;<%= @attached_object.email%>&gt;.</p>
<% else %>
<p><%= t('.body.imported_account_completed', PROVIDER: provider.name) %>
<%= "#{@attached_object.profile.full_name}" %> &lt;<%= @attached_object.email%>&gt;.</p>
<%= "#{@attached_object&.profile&.full_name || t('api.notifications.deleted_user')}" %> &lt;<%= @attached_object.email%>&gt;.</p>
<% end %>
<% if @attached_object.uid %>
<p><%= t('.body.provider_id', UID: @attached_object.uid) %></p>
<% end %>
<% end %>

View File

@ -1,6 +1,6 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.member_cancelled', NAME: @attached_object.reservation.user.profile.full_name) %></p>
<p><%= t('.body.member_cancelled', NAME: @attached_object.reservation.user&.profile&.full_name || t('api.notifications.deleted_user')) %></p>
<p><%= t('.body.item_details',
START: I18n.l(@attached_object.start_at, format: :long),
END:(I18n.l @attached_object.end_at, format: :hour_minute),

View File

@ -1,5 +1,5 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.slot_modified', NAME: @attached_object.reservation.user.profile.full_name) %></p>
<p><%= t('.body.slot_modified', NAME: @attached_object.reservation.user&.profile&.full_name || t('api.notifications.deleted_user')) %></p>
<p><%= t('.body.new_date') %> <%= "#{I18n.l @attached_object.start_at, format: :long} - #{I18n.l @attached_object.end_at, format: :hour_minute}" %></p>
<p><small><%= t('.body.old_date') %> <%= "#{I18n.l @attached_object.ex_start_at, format: :long} - #{I18n.l @attached_object.ex_end_at, format: :hour_minute}" %></small></p>

View File

@ -2,6 +2,6 @@
<p><%= t('.body.plan_subscribed_html',
PLAN: @attached_object.plan.human_readable_name,
NAME: @attached_object.user.profile.full_name) %>
NAME: @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user')) %>
</p>

View File

@ -2,5 +2,5 @@
<p><%= t('.body.subscription_canceled_html',
PLAN: @attached_object.plan.human_readable_name,
NAME: @attached_object.user.profile.full_name) %>
NAME: @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user')) %>
</p>

View File

@ -4,7 +4,7 @@
<%= _t('.body.subscription_extended_html',
{
PLAN: @attached_object.plan.human_readable_name,
NAME: @attached_object.user.profile.full_name,
NAME: @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'),
FREE: bool_to_sym(@notification.get_meta_data(:free_days)),
DATE: I18n.l(@attached_object.expired_at.to_date)
})

View File

@ -1,6 +1,6 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.subscription_expired_html',
NAME:@attached_object.user.profile.full_name,
NAME:@attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'),
PLAN: @attached_object.plan.human_readable_name) %>
</p>

View File

@ -1,6 +1,6 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.subscription_will_expire_html',
NAME:@attached_object.user.profile.full_name,
NAME:@attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'),
PLAN: @attached_object.plan.human_readable_name) %>
</p>

View File

@ -1,6 +1,6 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.user_changed_group_html', NAME: @attached_object.profile.full_name) %></p>
<p><%= t('.body.user_changed_group_html', NAME: @attached_object&.profile&.full_name || t('api.notifications.deleted_user')) %></p>
<p>
<small><%= t('.body.previous_group') %> <strong><%= "#{@notification.get_meta_data(:ex_group_name)}" %></strong></small>

View File

@ -3,7 +3,7 @@
<p><%= t('.body.imported_account_merged',
PROVIDER: provider.name,
NAME: @attached_object.profile.full_name) %>
NAME: @attached_object&.profile&.full_name || t('api.notifications.deleted_user')) %>
&lt;<%= @attached_object.email%>&gt;.
</p>

View File

@ -3,7 +3,7 @@
<p>
<%= t('.body.wallet_credit_html',
AMOUNT: number_to_currency(@attached_object.amount),
USER: @attached_object.wallet.user.profile.full_name,
ADMIN: @attached_object.user.profile.full_name)
USER: @attached_object.wallet.user&.profile&.full_name || t('api.notifications.deleted_user'),
ADMIN: @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user'))
%>
</p>

View File

@ -1,6 +1,6 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.new_account_created') %> "<%= @attached_object.profile.full_name %> &lt;<%= @attached_object.email%>&gt;"</p>
<p><%= t('.body.new_account_created') %> "<%= @attached_object&.profile&.full_name || t('api.notifications.deleted_user') %> &lt;<%= @attached_object.email%>&gt;"</p>
<% if @attached_object.invoicing_profile.organization %>
<p><%= t('.body.account_for_organization') %> <%= @attached_object.invoicing_profile.organization.name %></p>

View File

@ -1,3 +1,3 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<p><%= t('.body.a_plan') %> <strong><em><%= @attached_object.plan.human_readable_name %></em></strong> <%= t('.body.was_purchased_by_member') %> <strong><em><%= @attached_object.user.profile.full_name %></strong></em>.</p>
<p><%= t('.body.a_plan') %> <strong><em><%= @attached_object.plan.human_readable_name %></em></strong> <%= t('.body.was_purchased_by_member') %> <strong><em><%= @attached_object.user&.profile&.full_name || t('api.notifications.deleted_user') %></strong></em>.</p>

View File

@ -217,6 +217,7 @@ en:
api:
notifications:
# internal app notifications
deleted_user: "Deleted user"
notify_admin_abuse_reported:
an_abuse_was_reported_on_TYPE_ID_NAME_html: "An abuse was reported on <strong>%{TYPE} %{ID}: <em>%{NAME}</em></strong>."
notify_admin_member_create_reservation:

View File

@ -217,6 +217,7 @@ es:
api:
notifications:
# internal app notifications
deleted_user: "Usuario eliminado"
notify_admin_abuse_reported:
an_abuse_was_reported_on_TYPE_ID_NAME_html: "Un abuso ha sido reportado <strong>%{TYPE} %{ID}: <em>%{NAME}</em></strong>."
notify_admin_member_create_reservation:

View File

@ -217,6 +217,7 @@ fr:
api:
notifications:
# notifications internes à l'application
deleted_user: "Utilisateur supprimé"
notify_admin_abuse_reported:
an_abuse_was_reported_on_TYPE_ID_NAME_html: "Un abus a été signalé sur <strong>%{TYPE} %{ID} : <em>%{NAME}</em></strong>."
notify_admin_member_create_reservation:

View File

@ -217,6 +217,7 @@ pt:
api:
notifications:
# internal app notifications
deleted_user: "Usuário deletado"
notify_admin_abuse_reported:
an_abuse_was_reported_on_TYPE_ID_NAME_html: "Um abuso foi relatado em <strong> %{TYPE} %{ID}: <em> %{NAME} </em> </strong>."
notify_admin_member_create_reservation: